| 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 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 checkForDuplicateInitializers(initializingFormal.fieldElement, | 1590 checkForDuplicateInitializers(initializingFormal.fieldElement, |
| 1591 element.initializer); | 1591 element.initializer); |
| 1592 } | 1592 } |
| 1593 }); | 1593 }); |
| 1594 | 1594 |
| 1595 if (functionNode.initializers == null) { | 1595 if (functionNode.initializers == null) { |
| 1596 initializers = const Link<Node>(); | 1596 initializers = const Link<Node>(); |
| 1597 } else { | 1597 } else { |
| 1598 initializers = functionNode.initializers.nodes; | 1598 initializers = functionNode.initializers.nodes; |
| 1599 } | 1599 } |
| 1600 FunctionElement result; | |
| 1601 bool resolvedSuper = false; | 1600 bool resolvedSuper = false; |
| 1602 for (Link<Node> link = initializers; !link.isEmpty; link = link.tail) { | 1601 for (Link<Node> link = initializers; !link.isEmpty; link = link.tail) { |
| 1603 if (link.head.asSendSet() != null) { | 1602 if (link.head.asSendSet() != null) { |
| 1604 final SendSet init = link.head.asSendSet(); | 1603 final SendSet init = link.head.asSendSet(); |
| 1605 resolveFieldInitializer(constructor, init); | 1604 resolveFieldInitializer(constructor, init); |
| 1606 } else if (link.head.asSend() != null) { | 1605 } else if (link.head.asSend() != null) { |
| 1607 final Send call = link.head.asSend(); | 1606 final Send call = link.head.asSend(); |
| 1608 if (call.argumentsNode == null) { | 1607 if (call.argumentsNode == null) { |
| 1609 error(link.head, MessageKind.INVALID_INITIALIZER); | 1608 error(link.head, MessageKind.INVALID_INITIALIZER); |
| 1610 continue; | 1609 continue; |
| (...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3778 warning(element.label, MessageKind.UNUSED_LABEL, | 3777 warning(element.label, MessageKind.UNUSED_LABEL, |
| 3779 {'labelName': labelName}); | 3778 {'labelName': labelName}); |
| 3780 } | 3779 } |
| 3781 }); | 3780 }); |
| 3782 if (!targetElement.isTarget) { | 3781 if (!targetElement.isTarget) { |
| 3783 registry.undefineTarget(body); | 3782 registry.undefineTarget(body); |
| 3784 } | 3783 } |
| 3785 } | 3784 } |
| 3786 | 3785 |
| 3787 visitLiteralMap(LiteralMap node) { | 3786 visitLiteralMap(LiteralMap node) { |
| 3788 bool oldSendIsMemberAccess = sendIsMemberAccess; | |
| 3789 sendIsMemberAccess = false; | 3787 sendIsMemberAccess = false; |
| 3790 | 3788 |
| 3791 NodeList arguments = node.typeArguments; | 3789 NodeList arguments = node.typeArguments; |
| 3792 DartType keyTypeArgument; | 3790 DartType keyTypeArgument; |
| 3793 DartType valueTypeArgument; | 3791 DartType valueTypeArgument; |
| 3794 if (arguments != null) { | 3792 if (arguments != null) { |
| 3795 Link<Node> nodes = arguments.nodes; | 3793 Link<Node> nodes = arguments.nodes; |
| 3796 if (nodes.isEmpty) { | 3794 if (nodes.isEmpty) { |
| 3797 // The syntax [: <>{} :] is not allowed. | 3795 // The syntax [: <>{} :] is not allowed. |
| 3798 error(arguments, MessageKind.MISSING_TYPE_ARGUMENT); | 3796 error(arguments, MessageKind.MISSING_TYPE_ARGUMENT); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3852 return objectConstant.type; | 3850 return objectConstant.type; |
| 3853 } | 3851 } |
| 3854 | 3852 |
| 3855 bool overridesEquals(DartType type) { | 3853 bool overridesEquals(DartType type) { |
| 3856 ClassElement cls = type.element; | 3854 ClassElement cls = type.element; |
| 3857 Element equals = cls.lookupMember('=='); | 3855 Element equals = cls.lookupMember('=='); |
| 3858 return equals.enclosingClass != compiler.objectClass; | 3856 return equals.enclosingClass != compiler.objectClass; |
| 3859 } | 3857 } |
| 3860 | 3858 |
| 3861 void checkCaseExpressions(SwitchStatement node) { | 3859 void checkCaseExpressions(SwitchStatement node) { |
| 3862 JumpTarget breakElement = getOrDefineTarget(node); | |
| 3863 Map<String, LabelDefinition> continueLabels = <String, LabelDefinition>{}; | |
| 3864 | |
| 3865 Link<Node> cases = node.cases.nodes; | |
| 3866 CaseMatch firstCase = null; | 3860 CaseMatch firstCase = null; |
| 3867 DartType firstCaseType = null; | 3861 DartType firstCaseType = null; |
| 3868 bool hasReportedProblem = false; | 3862 bool hasReportedProblem = false; |
| 3869 | 3863 |
| 3870 for (Link<Node> cases = node.cases.nodes; | 3864 for (Link<Node> cases = node.cases.nodes; |
| 3871 !cases.isEmpty; | 3865 !cases.isEmpty; |
| 3872 cases = cases.tail) { | 3866 cases = cases.tail) { |
| 3873 SwitchCase switchCase = cases.head; | 3867 SwitchCase switchCase = cases.head; |
| 3874 | 3868 |
| 3875 for (Node labelOrCase in switchCase.labelsAndCases) { | 3869 for (Node labelOrCase in switchCase.labelsAndCases) { |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4477 new Modifiers.withFlags(new NodeList.empty(), Modifiers.FLAG_ABSTRACT)); | 4471 new Modifiers.withFlags(new NodeList.empty(), Modifiers.FLAG_ABSTRACT)); |
| 4478 // Create synthetic type variables for the mixin application. | 4472 // Create synthetic type variables for the mixin application. |
| 4479 List<DartType> typeVariables = <DartType>[]; | 4473 List<DartType> typeVariables = <DartType>[]; |
| 4480 element.typeVariables.forEach((TypeVariableType type) { | 4474 element.typeVariables.forEach((TypeVariableType type) { |
| 4481 TypeVariableElementX typeVariableElement = new TypeVariableElementX( | 4475 TypeVariableElementX typeVariableElement = new TypeVariableElementX( |
| 4482 type.name, mixinApplication, type.element.node); | 4476 type.name, mixinApplication, type.element.node); |
| 4483 TypeVariableType typeVariable = new TypeVariableType(typeVariableElement); | 4477 TypeVariableType typeVariable = new TypeVariableType(typeVariableElement); |
| 4484 typeVariables.add(typeVariable); | 4478 typeVariables.add(typeVariable); |
| 4485 }); | 4479 }); |
| 4486 // Setup bounds on the synthetic type variables. | 4480 // Setup bounds on the synthetic type variables. |
| 4487 List<DartType> link = typeVariables; | |
| 4488 int index = 0; | 4481 int index = 0; |
| 4489 element.typeVariables.forEach((TypeVariableType type) { | 4482 element.typeVariables.forEach((TypeVariableType type) { |
| 4490 TypeVariableType typeVariable = typeVariables[index++]; | 4483 TypeVariableType typeVariable = typeVariables[index++]; |
| 4491 TypeVariableElementX typeVariableElement = typeVariable.element; | 4484 TypeVariableElementX typeVariableElement = typeVariable.element; |
| 4492 typeVariableElement.typeCache = typeVariable; | 4485 typeVariableElement.typeCache = typeVariable; |
| 4493 typeVariableElement.boundCache = | 4486 typeVariableElement.boundCache = |
| 4494 type.element.bound.subst(typeVariables, element.typeVariables); | 4487 type.element.bound.subst(typeVariables, element.typeVariables); |
| 4495 }); | 4488 }); |
| 4496 // Setup this and raw type for the mixin application. | 4489 // Setup this and raw type for the mixin application. |
| 4497 mixinApplication.computeThisAndRawType(compiler, typeVariables); | 4490 mixinApplication.computeThisAndRawType(compiler, typeVariables); |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5170 } | 5163 } |
| 5171 | 5164 |
| 5172 /// The result for the resolution of the `assert` method. | 5165 /// The result for the resolution of the `assert` method. |
| 5173 class AssertResult implements ResolutionResult { | 5166 class AssertResult implements ResolutionResult { |
| 5174 const AssertResult(); | 5167 const AssertResult(); |
| 5175 | 5168 |
| 5176 Element get element => null; | 5169 Element get element => null; |
| 5177 | 5170 |
| 5178 String toString() => 'AssertResult()'; | 5171 String toString() => 'AssertResult()'; |
| 5179 } | 5172 } |
| OLD | NEW |