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 Element get currentElement; | 8 Element get currentElement; |
9 Set<Node> get superUses; | 9 Set<Node> get superUses; |
10 | 10 |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 return measure(() => SignatureResolver.analyze( | 869 return measure(() => SignatureResolver.analyze( |
870 compiler, node.parameters, node.returnType, element)); | 870 compiler, node.parameters, node.returnType, element)); |
871 } | 871 } |
872 | 872 |
873 TreeElements resolveTypedef(TypedefElementX element) { | 873 TreeElements resolveTypedef(TypedefElementX element) { |
874 if (element.isResolved) return element.mapping; | 874 if (element.isResolved) return element.mapping; |
875 TreeElementMapping mapping = new TreeElementMapping(element); | 875 TreeElementMapping mapping = new TreeElementMapping(element); |
876 // TODO(johnniwinther): Store the mapping in the resolution enqueuer. | 876 // TODO(johnniwinther): Store the mapping in the resolution enqueuer. |
877 element.mapping = mapping; | 877 element.mapping = mapping; |
878 return compiler.withCurrentElement(element, () { | 878 return compiler.withCurrentElement(element, () { |
879 measure(() { | 879 return measure(() { |
880 Typedef node = | 880 Typedef node = |
881 compiler.parser.measure(() => element.parseNode(compiler)); | 881 compiler.parser.measure(() => element.parseNode(compiler)); |
882 TypedefResolverVisitor visitor = | 882 TypedefResolverVisitor visitor = |
883 new TypedefResolverVisitor(compiler, element, mapping); | 883 new TypedefResolverVisitor(compiler, element, mapping); |
884 visitor.visit(node); | 884 visitor.visit(node); |
885 | 885 |
886 return mapping; | 886 return mapping; |
887 }); | 887 }); |
888 }); | 888 }); |
889 } | 889 } |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 target = | 2194 target = |
2195 warnAndCreateErroneousElement(node.selector, field.name, | 2195 warnAndCreateErroneousElement(node.selector, field.name, |
2196 MessageKind.CANNOT_RESOLVE_GETTER); | 2196 MessageKind.CANNOT_RESOLVE_GETTER); |
2197 } | 2197 } |
2198 } else if (target.isTypeVariable()) { | 2198 } else if (target.isTypeVariable()) { |
2199 ClassElement cls = target.getEnclosingClass(); | 2199 ClassElement cls = target.getEnclosingClass(); |
2200 assert(enclosingElement.getEnclosingClass() == cls); | 2200 assert(enclosingElement.getEnclosingClass() == cls); |
2201 compiler.backend.registerClassUsingVariableExpression(cls); | 2201 compiler.backend.registerClassUsingVariableExpression(cls); |
2202 compiler.backend.registerTypeVariableExpression(mapping); | 2202 compiler.backend.registerTypeVariableExpression(mapping); |
2203 } else if (target.impliesType() && !sendIsMemberAccess) { | 2203 } else if (target.impliesType() && !sendIsMemberAccess) { |
| 2204 // Set the type of the node to [Type] to mark this send as a |
| 2205 // type literal. |
| 2206 mapping.setType(node, compiler.typeClass.computeType(compiler)); |
| 2207 world.registerInstantiatedClass(compiler.typeClass, mapping); |
2204 compiler.backend.registerTypeLiteral(mapping); | 2208 compiler.backend.registerTypeLiteral(mapping); |
2205 } | 2209 } |
2206 } | 2210 } |
2207 | 2211 |
2208 bool resolvedArguments = false; | 2212 bool resolvedArguments = false; |
2209 if (node.isOperator) { | 2213 if (node.isOperator) { |
2210 String operatorString = node.selector.asOperator().source.stringValue; | 2214 String operatorString = node.selector.asOperator().source.stringValue; |
2211 if (operatorString == 'is') { | 2215 if (operatorString == 'is') { |
2212 DartType type = resolveTypeRequired(node.typeAnnotationFromIsCheck); | 2216 DartType type = resolveTypeRequired(node.typeAnnotationFromIsCheck); |
2213 if (type != null) { | 2217 if (type != null) { |
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3923 return e; | 3927 return e; |
3924 } | 3928 } |
3925 | 3929 |
3926 /// Assumed to be called by [resolveRedirectingFactory]. | 3930 /// Assumed to be called by [resolveRedirectingFactory]. |
3927 Element visitReturn(Return node) { | 3931 Element visitReturn(Return node) { |
3928 Node expression = node.expression; | 3932 Node expression = node.expression; |
3929 return finishConstructorReference(visit(expression), | 3933 return finishConstructorReference(visit(expression), |
3930 expression, expression); | 3934 expression, expression); |
3931 } | 3935 } |
3932 } | 3936 } |
OLD | NEW |