| 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.semantics_visitor.resolver; | 5 library dart2js.semantics_visitor.resolver; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 CallStructure callStructure, | 29 CallStructure callStructure, |
| 30 DartType type, | 30 DartType type, |
| 31 {bool mustBeConstant: false}) { | 31 {bool mustBeConstant: false}) { |
| 32 if (mustBeConstant && !constructor.isConst) { | 32 if (mustBeConstant && !constructor.isConst) { |
| 33 return new ConstructorAccessSemantics( | 33 return new ConstructorAccessSemantics( |
| 34 ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR, constructor, type); | 34 ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR, constructor, type); |
| 35 } | 35 } |
| 36 if (constructor.isMalformed) { | 36 if (constructor.isMalformed) { |
| 37 if (constructor is ErroneousElement) { | 37 if (constructor is ErroneousElement) { |
| 38 ErroneousElement error = constructor; | 38 ErroneousElement error = constructor; |
| 39 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) { | 39 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR || |
| 40 error.messageKind == MessageKind.CANNOT_FIND_UNNAMED_CONSTRUCTOR) { |
| 40 return new ConstructorAccessSemantics( | 41 return new ConstructorAccessSemantics( |
| 41 ConstructorAccessKind.UNRESOLVED_CONSTRUCTOR, constructor, type); | 42 ConstructorAccessKind.UNRESOLVED_CONSTRUCTOR, constructor, type); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 return new ConstructorAccessSemantics( | 45 return new ConstructorAccessSemantics( |
| 45 ConstructorAccessKind.UNRESOLVED_TYPE, constructor, type); | 46 ConstructorAccessKind.UNRESOLVED_TYPE, constructor, type); |
| 46 } else if (constructor.isRedirectingFactory) { | 47 } else if (constructor.isRedirectingFactory) { |
| 47 ConstructorElement effectiveTarget = constructor.effectiveTarget; | 48 ConstructorElement effectiveTarget = constructor.effectiveTarget; |
| 48 if (effectiveTarget == constructor || | 49 if (effectiveTarget == constructor || |
| 49 effectiveTarget.isMalformed || | 50 effectiveTarget.isMalformed || |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 return internalError(node, "Unexpected variable $element."); | 469 return internalError(node, "Unexpected variable $element."); |
| 469 } | 470 } |
| 470 if (element.isConst) { | 471 if (element.isConst) { |
| 471 ConstantExpression constant = elements.getConstant(element.initializer); | 472 ConstantExpression constant = elements.getConstant(element.initializer); |
| 472 return new ConstantVariableStructure(kind, node, element, constant); | 473 return new ConstantVariableStructure(kind, node, element, constant); |
| 473 } else { | 474 } else { |
| 474 return new NonConstantVariableStructure(kind, node, element); | 475 return new NonConstantVariableStructure(kind, node, element); |
| 475 } | 476 } |
| 476 } | 477 } |
| 477 } | 478 } |
| OLD | NEW |