Drop some ClassDescriptor.getConstructors() usages

supposing that there is only primary constructor
This commit is contained in:
Denis Zharkov
2015-02-05 09:02:01 +03:00
parent bdd2756bd1
commit cb881d2628
3 changed files with 11 additions and 11 deletions
@@ -81,7 +81,8 @@ public abstract class DataClassMethodGenerator {
private void generateComponentFunctionsForDataClasses() {
if (!declaration.hasPrimaryConstructor()) return;
ConstructorDescriptor constructor = classDescriptor.getConstructors().iterator().next();
ConstructorDescriptor constructor = classDescriptor.getUnsubstitutedPrimaryConstructor();
assert constructor != null : "Data class should have primary constructor";
for (ValueParameterDescriptor parameter : constructor.getValueParameters()) {
FunctionDescriptor function = bindingContext.get(BindingContext.DATA_CLASS_COMPONENT_FUNCTION, parameter);