| 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 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 addTypeVariableBoundsCheck = true; | 1953 addTypeVariableBoundsCheck = true; |
| 1954 } | 1954 } |
| 1955 } | 1955 } |
| 1956 } else if (element.isTypeVariable) { | 1956 } else if (element.isTypeVariable) { |
| 1957 Element outer = | 1957 Element outer = |
| 1958 visitor.enclosingElement.outermostEnclosingMemberOrTopLevel; | 1958 visitor.enclosingElement.outermostEnclosingMemberOrTopLevel; |
| 1959 bool isInFactoryConstructor = | 1959 bool isInFactoryConstructor = |
| 1960 outer != null && outer.isFactoryConstructor; | 1960 outer != null && outer.isFactoryConstructor; |
| 1961 if (!outer.isClass && | 1961 if (!outer.isClass && |
| 1962 !outer.isTypedef && | 1962 !outer.isTypedef && |
| 1963 !isInFactoryConstructor && | 1963 !Elements.hasAccessToTypeVariables(visitor.enclosingElement)) { |
| 1964 Elements.isInStaticContext(visitor.enclosingElement)) { | |
| 1965 registry.registerThrowRuntimeError(); | 1964 registry.registerThrowRuntimeError(); |
| 1966 type = reportFailureAndCreateType( | 1965 type = reportFailureAndCreateType( |
| 1967 MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, | 1966 MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, |
| 1968 {'typeVariableName': node}, | 1967 {'typeVariableName': node}, |
| 1969 userProvidedBadType: element.computeType(compiler)); | 1968 userProvidedBadType: element.computeType(compiler)); |
| 1970 } else { | 1969 } else { |
| 1971 type = element.computeType(compiler); | 1970 type = element.computeType(compiler); |
| 1972 } | 1971 } |
| 1973 type = checkNoTypeArguments(type); | 1972 type = checkNoTypeArguments(type); |
| 1974 } else { | 1973 } else { |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 AbstractFieldElement field = target; | 2833 AbstractFieldElement field = target; |
| 2835 target = field.getter; | 2834 target = field.getter; |
| 2836 if (target == null && !inInstanceContext) { | 2835 if (target == null && !inInstanceContext) { |
| 2837 registry.registerThrowNoSuchMethod(); | 2836 registry.registerThrowNoSuchMethod(); |
| 2838 target = reportAndCreateErroneousElement(node.selector, field.name, | 2837 target = reportAndCreateErroneousElement(node.selector, field.name, |
| 2839 MessageKind.CANNOT_RESOLVE_GETTER, const {}); | 2838 MessageKind.CANNOT_RESOLVE_GETTER, const {}); |
| 2840 } | 2839 } |
| 2841 } else if (target.isTypeVariable) { | 2840 } else if (target.isTypeVariable) { |
| 2842 ClassElement cls = target.enclosingClass; | 2841 ClassElement cls = target.enclosingClass; |
| 2843 assert(enclosingElement.enclosingClass == cls); | 2842 assert(enclosingElement.enclosingClass == cls); |
| 2844 if (Elements.isInStaticContext(enclosingElement)) { | 2843 if (!Elements.hasAccessToTypeVariables(enclosingElement)) { |
| 2845 compiler.reportError(node, | 2844 compiler.reportError(node, |
| 2846 MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, | 2845 MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, |
| 2847 {'typeVariableName': node.selector}); | 2846 {'typeVariableName': node.selector}); |
| 2848 } | 2847 } |
| 2849 registry.registerClassUsingVariableExpression(cls); | 2848 registry.registerClassUsingVariableExpression(cls); |
| 2850 registry.registerTypeVariableExpression(); | 2849 registry.registerTypeVariableExpression(); |
| 2851 // Set the type of the node to [Type] to mark this send as a | 2850 // Set the type of the node to [Type] to mark this send as a |
| 2852 // type variable expression. | 2851 // type variable expression. |
| 2853 registry.registerTypeLiteral(node, target.computeType(compiler)); | 2852 registry.registerTypeLiteral(node, target.computeType(compiler)); |
| 2854 } else if (target.impliesType && (!sendIsMemberAccess || node.isCall)) { | 2853 } else if (target.impliesType && (!sendIsMemberAccess || node.isCall)) { |
| (...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5147 } | 5146 } |
| 5148 | 5147 |
| 5149 /// The result for the resolution of the `assert` method. | 5148 /// The result for the resolution of the `assert` method. |
| 5150 class AssertResult implements ResolutionResult { | 5149 class AssertResult implements ResolutionResult { |
| 5151 const AssertResult(); | 5150 const AssertResult(); |
| 5152 | 5151 |
| 5153 Element get element => null; | 5152 Element get element => null; |
| 5154 | 5153 |
| 5155 String toString() => 'AssertResult()'; | 5154 String toString() => 'AssertResult()'; |
| 5156 } | 5155 } |
| OLD | NEW |