| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 ConstructorAccessSemantics computeConstructorAccessSemantics( | 27 ConstructorAccessSemantics computeConstructorAccessSemantics( |
| 28 ConstructorElement constructor, | 28 ConstructorElement constructor, |
| 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.isErroneous) { | 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 return new ConstructorAccessSemantics( | 40 return new ConstructorAccessSemantics( |
| 41 ConstructorAccessKind.UNRESOLVED_CONSTRUCTOR, constructor, type); | 41 ConstructorAccessKind.UNRESOLVED_CONSTRUCTOR, constructor, type); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 return new ConstructorAccessSemantics( | 44 return new ConstructorAccessSemantics( |
| 45 ConstructorAccessKind.UNRESOLVED_TYPE, constructor, type); | 45 ConstructorAccessKind.UNRESOLVED_TYPE, constructor, type); |
| 46 } else if (constructor.isRedirectingFactory) { | 46 } else if (constructor.isRedirectingFactory) { |
| 47 ConstructorElement effectiveTarget = constructor.effectiveTarget; | 47 ConstructorElement effectiveTarget = constructor.effectiveTarget; |
| 48 if (effectiveTarget == constructor || | 48 if (effectiveTarget == constructor || |
| 49 effectiveTarget.isErroneous || | 49 effectiveTarget.isMalformed || |
| 50 (mustBeConstant && !effectiveTarget.isConst)) { | 50 (mustBeConstant && !effectiveTarget.isConst)) { |
| 51 return new ConstructorAccessSemantics( | 51 return new ConstructorAccessSemantics( |
| 52 ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY, | 52 ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY, |
| 53 constructor, | 53 constructor, |
| 54 type); | 54 type); |
| 55 } | 55 } |
| 56 ConstructorAccessSemantics effectiveTargetSemantics = | 56 ConstructorAccessSemantics effectiveTargetSemantics = |
| 57 computeConstructorAccessSemantics( | 57 computeConstructorAccessSemantics( |
| 58 effectiveTarget, | 58 effectiveTarget, |
| 59 callStructure, | 59 callStructure, |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 return internalError(node, "Unexpected variable $element."); | 468 return internalError(node, "Unexpected variable $element."); |
| 469 } | 469 } |
| 470 if (element.isConst) { | 470 if (element.isConst) { |
| 471 ConstantExpression constant = elements.getConstant(element.initializer); | 471 ConstantExpression constant = elements.getConstant(element.initializer); |
| 472 return new ConstantVariableStructure(kind, node, element, constant); | 472 return new ConstantVariableStructure(kind, node, element, constant); |
| 473 } else { | 473 } else { |
| 474 return new NonConstantVariableStructure(kind, node, element); | 474 return new NonConstantVariableStructure(kind, node, element); |
| 475 } | 475 } |
| 476 } | 476 } |
| 477 } | 477 } |
| OLD | NEW |