| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dart2js.resolution.constructors; | 5 library dart2js.resolution.constructors; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
| 9 import '../constants/constructors.dart' | 9 import '../constants/constructors.dart' |
| 10 show | 10 show |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 isValidAsConstant = false; | 338 isValidAsConstant = false; |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 if (element.isInitializingFormal) { | 343 if (element.isInitializingFormal) { |
| 344 VariableDefinitions variableDefinitions = parameterNodes.head; | 344 VariableDefinitions variableDefinitions = parameterNodes.head; |
| 345 Node parameterNode = variableDefinitions.definitions.nodes.head; | 345 Node parameterNode = variableDefinitions.definitions.nodes.head; |
| 346 InitializingFormalElementX initializingFormal = element; | 346 InitializingFormalElementX initializingFormal = element; |
| 347 FieldElement field = initializingFormal.fieldElement; | 347 FieldElement field = initializingFormal.fieldElement; |
| 348 if (!field.isMalformed) { |
| 349 registry.registerStaticUse(new StaticUse.fieldInit(field)); |
| 350 } |
| 348 checkForDuplicateInitializers(field, element.initializer); | 351 checkForDuplicateInitializers(field, element.initializer); |
| 349 if (enableInitializingFormalAccess) { | 352 if (enableInitializingFormalAccess) { |
| 350 visitor.defineLocalVariable(parameterNode, initializingFormal); | 353 visitor.defineLocalVariable(parameterNode, initializingFormal); |
| 351 visitor.addToScope(initializingFormal); | 354 visitor.addToScope(initializingFormal); |
| 352 } | 355 } |
| 353 if (isConst) { | 356 if (isConst) { |
| 354 if (element.isNamed) { | 357 if (element.isNamed) { |
| 355 fieldInitializers[field] = new NamedArgumentReference(element.name); | 358 fieldInitializers[field] = new NamedArgumentReference(element.name); |
| 356 } else { | 359 } else { |
| 357 int index = element.functionDeclaration.parameters.indexOf(element); | 360 int index = element.functionDeclaration.parameters.indexOf(element); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 // constructors. | 884 // constructors. |
| 882 return null; | 885 return null; |
| 883 } | 886 } |
| 884 // TODO(johnniwinther): Use [Name] for lookup. | 887 // TODO(johnniwinther): Use [Name] for lookup. |
| 885 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 888 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
| 886 if (constructor != null) { | 889 if (constructor != null) { |
| 887 constructor = constructor.declaration; | 890 constructor = constructor.declaration; |
| 888 } | 891 } |
| 889 return constructor; | 892 return constructor; |
| 890 } | 893 } |
| OLD | NEW |