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 2267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2278 // Set the type of the node to [Type] to mark this send as a | 2278 // Set the type of the node to [Type] to mark this send as a |
2279 // type literal. | 2279 // type literal. |
2280 mapping.setType(node, compiler.typeClass.computeType(compiler)); | 2280 mapping.setType(node, compiler.typeClass.computeType(compiler)); |
2281 world.registerTypeLiteral(target, mapping); | 2281 world.registerTypeLiteral(target, mapping); |
2282 } | 2282 } |
2283 } | 2283 } |
2284 | 2284 |
2285 bool resolvedArguments = false; | 2285 bool resolvedArguments = false; |
2286 if (node.isOperator) { | 2286 if (node.isOperator) { |
2287 String operatorString = node.selector.asOperator().source.stringValue; | 2287 String operatorString = node.selector.asOperator().source.stringValue; |
2288 if (operatorString == 'is') { | 2288 if (identical(operatorString, 'is')) { |
2289 DartType type = | 2289 DartType type = |
2290 resolveTypeExpression(node.typeAnnotationFromIsCheckOrCast); | 2290 resolveTypeExpression(node.typeAnnotationFromIsCheckOrCast); |
2291 if (type != null) { | 2291 if (type != null) { |
2292 compiler.enqueuer.resolution.registerIsCheck(type, mapping); | 2292 compiler.enqueuer.resolution.registerIsCheck(type, mapping); |
2293 } | 2293 } |
2294 resolvedArguments = true; | 2294 resolvedArguments = true; |
2295 } else if (operatorString == 'as') { | 2295 } else if (identical(operatorString, 'as')) { |
2296 DartType type = resolveTypeExpression(node.arguments.head); | 2296 DartType type = resolveTypeExpression(node.arguments.head); |
2297 if (type != null) { | 2297 if (type != null) { |
2298 compiler.enqueuer.resolution.registerAsCheck(type, mapping); | 2298 compiler.enqueuer.resolution.registerAsCheck(type, mapping); |
2299 } | 2299 } |
2300 resolvedArguments = true; | 2300 resolvedArguments = true; |
2301 } | 2301 } |
2302 } | 2302 } |
2303 | 2303 |
2304 if (!resolvedArguments) { | 2304 if (!resolvedArguments) { |
2305 oldSendIsMemberAccess = sendIsMemberAccess; | 2305 oldSendIsMemberAccess = sendIsMemberAccess; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 world.registerInstantiatedClass( | 2575 world.registerInstantiatedClass( |
2576 redirectionTarget.enclosingElement.declaration, mapping); | 2576 redirectionTarget.enclosingElement.declaration, mapping); |
2577 if (isSymbolConstructor) { | 2577 if (isSymbolConstructor) { |
2578 // Make sure that collection_dev.Symbol.validated is registered. | 2578 // Make sure that collection_dev.Symbol.validated is registered. |
2579 assert(invariant(node, compiler.symbolValidatedConstructor != null)); | 2579 assert(invariant(node, compiler.symbolValidatedConstructor != null)); |
2580 world.registerStaticUse(compiler.symbolValidatedConstructor); | 2580 world.registerStaticUse(compiler.symbolValidatedConstructor); |
2581 } | 2581 } |
2582 } | 2582 } |
2583 | 2583 |
2584 visitThrow(Throw node) { | 2584 visitThrow(Throw node) { |
2585 // We don't know ahead of time whether we will need the throw in a | |
2586 // statement context or an expression context, so we register both | |
2587 // here, even though we may not need ThrowExpression. | |
2588 compiler.backend.registerWrapException(mapping); | |
2589 compiler.backend.registerThrowExpression(mapping); | 2585 compiler.backend.registerThrowExpression(mapping); |
2590 visit(node.expression); | 2586 visit(node.expression); |
2591 } | 2587 } |
2592 | 2588 |
2593 visitVariableDefinitions(VariableDefinitions node) { | 2589 visitVariableDefinitions(VariableDefinitions node) { |
2594 VariableDefinitionsVisitor visitor = | 2590 VariableDefinitionsVisitor visitor = |
2595 new VariableDefinitionsVisitor(compiler, node, this, | 2591 new VariableDefinitionsVisitor(compiler, node, this, |
2596 ElementKind.VARIABLE); | 2592 ElementKind.VARIABLE); |
2597 // Ensure that we set the type of the [VariableListElement] since it depends | 2593 // Ensure that we set the type of the [VariableListElement] since it depends |
2598 // on the current scope. If the current scope is a [MethodScope] or | 2594 // on the current scope. If the current scope is a [MethodScope] or |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4091 return e; | 4087 return e; |
4092 } | 4088 } |
4093 | 4089 |
4094 /// Assumed to be called by [resolveRedirectingFactory]. | 4090 /// Assumed to be called by [resolveRedirectingFactory]. |
4095 Element visitReturn(Return node) { | 4091 Element visitReturn(Return node) { |
4096 Node expression = node.expression; | 4092 Node expression = node.expression; |
4097 return finishConstructorReference(visit(expression), | 4093 return finishConstructorReference(visit(expression), |
4098 expression, expression); | 4094 expression, expression); |
4099 } | 4095 } |
4100 } | 4096 } |
OLD | NEW |