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 | 8 import '../common/resolution.dart' show |
9 Feature; | 9 Feature; |
10 import '../compiler.dart' show | 10 import '../compiler.dart' show |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 constructorInvocation = result.constant; | 399 constructorInvocation = result.constant; |
400 } else { | 400 } else { |
401 isValidAsConstant = false; | 401 isValidAsConstant = false; |
402 } | 402 } |
403 } | 403 } |
404 resolvedSuper = true; | 404 resolvedSuper = true; |
405 } else if (Initializers.isConstructorRedirect(call)) { | 405 } else if (Initializers.isConstructorRedirect(call)) { |
406 // Check that there is no body (Language specification 7.5.1). If the | 406 // Check that there is no body (Language specification 7.5.1). If the |
407 // constructor is also const, we already reported an error in | 407 // constructor is also const, we already reported an error in |
408 // [resolveMethodElement]. | 408 // [resolveMethodElement]. |
409 if (functionNode.hasBody() && !constructor.isConst) { | 409 if (functionNode.hasBody && !constructor.isConst) { |
410 reporter.reportErrorMessage( | 410 reporter.reportErrorMessage( |
411 functionNode, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY); | 411 functionNode, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY); |
412 } | 412 } |
413 // Check that there are no other initializers. | 413 // Check that there are no other initializers. |
414 if (!initializers.tail.isEmpty) { | 414 if (!initializers.tail.isEmpty) { |
415 reporter.reportErrorMessage( | 415 reporter.reportErrorMessage( |
416 call, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER); | 416 call, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER); |
417 } else { | 417 } else { |
418 constructor.isRedirectingGenerative = true; | 418 constructor.isRedirectingGenerative = true; |
419 } | 419 } |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 // constructors. | 871 // constructors. |
872 return null; | 872 return null; |
873 } | 873 } |
874 // TODO(johnniwinther): Use [Name] for lookup. | 874 // TODO(johnniwinther): Use [Name] for lookup. |
875 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 875 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
876 if (constructor != null) { | 876 if (constructor != null) { |
877 constructor = constructor.declaration; | 877 constructor = constructor.declaration; |
878 } | 878 } |
879 return constructor; | 879 return constructor; |
880 } | 880 } |
OLD | NEW |