| 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 registry.registerStaticUse(new StaticUse.fieldInit(field)); | |
| 349 checkForDuplicateInitializers(field, element.initializer); | 348 checkForDuplicateInitializers(field, element.initializer); |
| 350 if (enableInitializingFormalAccess) { | 349 if (enableInitializingFormalAccess) { |
| 351 visitor.defineLocalVariable(parameterNode, initializingFormal); | 350 visitor.defineLocalVariable(parameterNode, initializingFormal); |
| 352 visitor.addToScope(initializingFormal); | 351 visitor.addToScope(initializingFormal); |
| 353 } | 352 } |
| 354 if (isConst) { | 353 if (isConst) { |
| 355 if (element.isNamed) { | 354 if (element.isNamed) { |
| 356 fieldInitializers[field] = new NamedArgumentReference(element.name); | 355 fieldInitializers[field] = new NamedArgumentReference(element.name); |
| 357 } else { | 356 } else { |
| 358 int index = element.functionDeclaration.parameters.indexOf(element); | 357 int index = element.functionDeclaration.parameters.indexOf(element); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 // constructors. | 881 // constructors. |
| 883 return null; | 882 return null; |
| 884 } | 883 } |
| 885 // TODO(johnniwinther): Use [Name] for lookup. | 884 // TODO(johnniwinther): Use [Name] for lookup. |
| 886 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 885 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
| 887 if (constructor != null) { | 886 if (constructor != null) { |
| 888 constructor = constructor.declaration; | 887 constructor = constructor.declaration; |
| 889 } | 888 } |
| 890 return constructor; | 889 return constructor; |
| 891 } | 890 } |
| OLD | NEW |