| 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 } | 338 } |
| 339 } | 339 } |
| 340 if (element.isInitializingFormal) { | 340 if (element.isInitializingFormal) { |
| 341 VariableDefinitions variableDefinitions = parameterNodes.head; | 341 VariableDefinitions variableDefinitions = parameterNodes.head; |
| 342 Node parameterNode = variableDefinitions.definitions.nodes.head; | 342 Node parameterNode = variableDefinitions.definitions.nodes.head; |
| 343 InitializingFormalElementX initializingFormal = element; | 343 InitializingFormalElementX initializingFormal = element; |
| 344 FieldElement field = initializingFormal.fieldElement; | 344 FieldElement field = initializingFormal.fieldElement; |
| 345 if (!field.isMalformed) { | 345 if (!field.isMalformed) { |
| 346 registry.registerStaticUse(new StaticUse.fieldInit(field)); | 346 registry.registerStaticUse(new StaticUse.fieldInit(field)); |
| 347 } | 347 } |
| 348 checkForDuplicateInitializers(field, element.initializer); | 348 checkForDuplicateInitializers(field, parameterNode); |
| 349 visitor.defineLocalVariable(parameterNode, initializingFormal); | 349 visitor.defineLocalVariable(parameterNode, initializingFormal); |
| 350 visitor.addToScope(initializingFormal); | 350 visitor.addToScope(initializingFormal); |
| 351 if (isConst) { | 351 if (isConst) { |
| 352 if (element.isNamed) { | 352 if (element.isNamed) { |
| 353 fieldInitializers[field] = new NamedArgumentReference(element.name); | 353 fieldInitializers[field] = new NamedArgumentReference(element.name); |
| 354 } else { | 354 } else { |
| 355 int index = element.functionDeclaration.parameters.indexOf(element); | 355 int index = element.functionDeclaration.parameters.indexOf(element); |
| 356 fieldInitializers[field] = new PositionalArgumentReference(index); | 356 fieldInitializers[field] = new PositionalArgumentReference(index); |
| 357 } | 357 } |
| 358 } else { | 358 } else { |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 // constructors. | 879 // constructors. |
| 880 return null; | 880 return null; |
| 881 } | 881 } |
| 882 // TODO(johnniwinther): Use [Name] for lookup. | 882 // TODO(johnniwinther): Use [Name] for lookup. |
| 883 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 883 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
| 884 if (constructor != null) { | 884 if (constructor != null) { |
| 885 constructor = constructor.declaration; | 885 constructor = constructor.declaration; |
| 886 } | 886 } |
| 887 return constructor; | 887 return constructor; |
| 888 } | 888 } |
| OLD | NEW |