| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 AnalyzableElement get analyzedElement; | 8 AnalyzableElement get analyzedElement; |
| 9 Iterable<Node> get superUses; | 9 Iterable<Node> get superUses; |
| 10 | 10 |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 checkForDuplicateInitializers(initializingFormal.fieldElement, | 1605 checkForDuplicateInitializers(initializingFormal.fieldElement, |
| 1606 element.initializer); | 1606 element.initializer); |
| 1607 } | 1607 } |
| 1608 }); | 1608 }); |
| 1609 | 1609 |
| 1610 if (functionNode.initializers == null) { | 1610 if (functionNode.initializers == null) { |
| 1611 initializers = const Link<Node>(); | 1611 initializers = const Link<Node>(); |
| 1612 } else { | 1612 } else { |
| 1613 initializers = functionNode.initializers.nodes; | 1613 initializers = functionNode.initializers.nodes; |
| 1614 } | 1614 } |
| 1615 FunctionElement result; | |
| 1616 bool resolvedSuper = false; | 1615 bool resolvedSuper = false; |
| 1617 for (Link<Node> link = initializers; !link.isEmpty; link = link.tail) { | 1616 for (Link<Node> link = initializers; !link.isEmpty; link = link.tail) { |
| 1618 if (link.head.asSendSet() != null) { | 1617 if (link.head.asSendSet() != null) { |
| 1619 final SendSet init = link.head.asSendSet(); | 1618 final SendSet init = link.head.asSendSet(); |
| 1620 resolveFieldInitializer(constructor, init); | 1619 resolveFieldInitializer(constructor, init); |
| 1621 } else if (link.head.asSend() != null) { | 1620 } else if (link.head.asSend() != null) { |
| 1622 final Send call = link.head.asSend(); | 1621 final Send call = link.head.asSend(); |
| 1623 if (call.argumentsNode == null) { | 1622 if (call.argumentsNode == null) { |
| 1624 error(link.head, MessageKind.INVALID_INITIALIZER); | 1623 error(link.head, MessageKind.INVALID_INITIALIZER); |
| 1625 continue; | 1624 continue; |
| (...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3809 warning(element.label, MessageKind.UNUSED_LABEL, | 3808 warning(element.label, MessageKind.UNUSED_LABEL, |
| 3810 {'labelName': labelName}); | 3809 {'labelName': labelName}); |
| 3811 } | 3810 } |
| 3812 }); | 3811 }); |
| 3813 if (!targetElement.isTarget) { | 3812 if (!targetElement.isTarget) { |
| 3814 registry.undefineTarget(body); | 3813 registry.undefineTarget(body); |
| 3815 } | 3814 } |
| 3816 } | 3815 } |
| 3817 | 3816 |
| 3818 visitLiteralMap(LiteralMap node) { | 3817 visitLiteralMap(LiteralMap node) { |
| 3819 bool oldSendIsMemberAccess = sendIsMemberAccess; | |
| 3820 sendIsMemberAccess = false; | 3818 sendIsMemberAccess = false; |
| 3821 | 3819 |
| 3822 NodeList arguments = node.typeArguments; | 3820 NodeList arguments = node.typeArguments; |
| 3823 DartType keyTypeArgument; | 3821 DartType keyTypeArgument; |
| 3824 DartType valueTypeArgument; | 3822 DartType valueTypeArgument; |
| 3825 if (arguments != null) { | 3823 if (arguments != null) { |
| 3826 Link<Node> nodes = arguments.nodes; | 3824 Link<Node> nodes = arguments.nodes; |
| 3827 if (nodes.isEmpty) { | 3825 if (nodes.isEmpty) { |
| 3828 // The syntax [: <>{} :] is not allowed. | 3826 // The syntax [: <>{} :] is not allowed. |
| 3829 error(arguments, MessageKind.MISSING_TYPE_ARGUMENT); | 3827 error(arguments, MessageKind.MISSING_TYPE_ARGUMENT); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3883 return objectConstant.type; | 3881 return objectConstant.type; |
| 3884 } | 3882 } |
| 3885 | 3883 |
| 3886 bool overridesEquals(DartType type) { | 3884 bool overridesEquals(DartType type) { |
| 3887 ClassElement cls = type.element; | 3885 ClassElement cls = type.element; |
| 3888 Element equals = cls.lookupMember('=='); | 3886 Element equals = cls.lookupMember('=='); |
| 3889 return equals.enclosingClass != compiler.objectClass; | 3887 return equals.enclosingClass != compiler.objectClass; |
| 3890 } | 3888 } |
| 3891 | 3889 |
| 3892 void checkCaseExpressions(SwitchStatement node) { | 3890 void checkCaseExpressions(SwitchStatement node) { |
| 3893 JumpTarget breakElement = getOrDefineTarget(node); | |
| 3894 Map<String, LabelDefinition> continueLabels = <String, LabelDefinition>{}; | |
| 3895 | |
| 3896 Link<Node> cases = node.cases.nodes; | |
| 3897 CaseMatch firstCase = null; | 3891 CaseMatch firstCase = null; |
| 3898 DartType firstCaseType = null; | 3892 DartType firstCaseType = null; |
| 3899 bool hasReportedProblem = false; | 3893 bool hasReportedProblem = false; |
| 3900 | 3894 |
| 3901 for (Link<Node> cases = node.cases.nodes; | 3895 for (Link<Node> cases = node.cases.nodes; |
| 3902 !cases.isEmpty; | 3896 !cases.isEmpty; |
| 3903 cases = cases.tail) { | 3897 cases = cases.tail) { |
| 3904 SwitchCase switchCase = cases.head; | 3898 SwitchCase switchCase = cases.head; |
| 3905 | 3899 |
| 3906 for (Node labelOrCase in switchCase.labelsAndCases) { | 3900 for (Node labelOrCase in switchCase.labelsAndCases) { |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4508 new Modifiers.withFlags(new NodeList.empty(), Modifiers.FLAG_ABSTRACT)); | 4502 new Modifiers.withFlags(new NodeList.empty(), Modifiers.FLAG_ABSTRACT)); |
| 4509 // Create synthetic type variables for the mixin application. | 4503 // Create synthetic type variables for the mixin application. |
| 4510 List<DartType> typeVariables = <DartType>[]; | 4504 List<DartType> typeVariables = <DartType>[]; |
| 4511 element.typeVariables.forEach((TypeVariableType type) { | 4505 element.typeVariables.forEach((TypeVariableType type) { |
| 4512 TypeVariableElementX typeVariableElement = new TypeVariableElementX( | 4506 TypeVariableElementX typeVariableElement = new TypeVariableElementX( |
| 4513 type.name, mixinApplication, type.element.node); | 4507 type.name, mixinApplication, type.element.node); |
| 4514 TypeVariableType typeVariable = new TypeVariableType(typeVariableElement); | 4508 TypeVariableType typeVariable = new TypeVariableType(typeVariableElement); |
| 4515 typeVariables.add(typeVariable); | 4509 typeVariables.add(typeVariable); |
| 4516 }); | 4510 }); |
| 4517 // Setup bounds on the synthetic type variables. | 4511 // Setup bounds on the synthetic type variables. |
| 4518 List<DartType> link = typeVariables; | |
| 4519 int index = 0; | 4512 int index = 0; |
| 4520 element.typeVariables.forEach((TypeVariableType type) { | 4513 element.typeVariables.forEach((TypeVariableType type) { |
| 4521 TypeVariableType typeVariable = typeVariables[index++]; | 4514 TypeVariableType typeVariable = typeVariables[index++]; |
| 4522 TypeVariableElementX typeVariableElement = typeVariable.element; | 4515 TypeVariableElementX typeVariableElement = typeVariable.element; |
| 4523 typeVariableElement.typeCache = typeVariable; | 4516 typeVariableElement.typeCache = typeVariable; |
| 4524 typeVariableElement.boundCache = | 4517 typeVariableElement.boundCache = |
| 4525 type.element.bound.subst(typeVariables, element.typeVariables); | 4518 type.element.bound.subst(typeVariables, element.typeVariables); |
| 4526 }); | 4519 }); |
| 4527 // Setup this and raw type for the mixin application. | 4520 // Setup this and raw type for the mixin application. |
| 4528 mixinApplication.computeThisAndRawType(compiler, typeVariables); | 4521 mixinApplication.computeThisAndRawType(compiler, typeVariables); |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5201 } | 5194 } |
| 5202 | 5195 |
| 5203 /// The result for the resolution of the `assert` method. | 5196 /// The result for the resolution of the `assert` method. |
| 5204 class AssertResult implements ResolutionResult { | 5197 class AssertResult implements ResolutionResult { |
| 5205 const AssertResult(); | 5198 const AssertResult(); |
| 5206 | 5199 |
| 5207 Element get element => null; | 5200 Element get element => null; |
| 5208 | 5201 |
| 5209 String toString() => 'AssertResult()'; | 5202 String toString() => 'AssertResult()'; |
| 5210 } | 5203 } |
| OLD | NEW |