| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 // [resolveMethodElement]. | 404 // [resolveMethodElement]. |
| 405 if (functionNode.hasBody && !constructor.isConst) { | 405 if (functionNode.hasBody && !constructor.isConst) { |
| 406 reporter.reportErrorMessage( | 406 reporter.reportErrorMessage( |
| 407 functionNode, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY); | 407 functionNode, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY); |
| 408 } | 408 } |
| 409 // Check that there are no other initializers. | 409 // Check that there are no other initializers. |
| 410 if (!initializers.tail.isEmpty) { | 410 if (!initializers.tail.isEmpty) { |
| 411 reporter.reportErrorMessage( | 411 reporter.reportErrorMessage( |
| 412 call, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER); | 412 call, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER); |
| 413 } else { | 413 } else { |
| 414 constructor.isRedirectingGenerative = true; | 414 constructor.isRedirectingGenerativeInternal = true; |
| 415 } | 415 } |
| 416 // Check that there are no field initializing parameters. | 416 // Check that there are no field initializing parameters. |
| 417 FunctionSignature signature = constructor.functionSignature; | 417 FunctionSignature signature = constructor.functionSignature; |
| 418 signature.forEachParameter((ParameterElement parameter) { | 418 signature.forEachParameter((ParameterElement parameter) { |
| 419 if (parameter.isInitializingFormal) { | 419 if (parameter.isInitializingFormal) { |
| 420 Node node = parameter.node; | 420 Node node = parameter.node; |
| 421 reporter.reportErrorMessage( | 421 reporter.reportErrorMessage( |
| 422 node, MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED); | 422 node, MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED); |
| 423 isValidAsConstant = false; | 423 isValidAsConstant = false; |
| 424 } | 424 } |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 // constructors. | 884 // constructors. |
| 885 return null; | 885 return null; |
| 886 } | 886 } |
| 887 // TODO(johnniwinther): Use [Name] for lookup. | 887 // TODO(johnniwinther): Use [Name] for lookup. |
| 888 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 888 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
| 889 if (constructor != null) { | 889 if (constructor != null) { |
| 890 constructor = constructor.declaration; | 890 constructor = constructor.declaration; |
| 891 } | 891 } |
| 892 return constructor; | 892 return constructor; |
| 893 } | 893 } |
| OLD | NEW |