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 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2436 visitNodeList(NodeList node) { | 2436 visitNodeList(NodeList node) { |
2437 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { | 2437 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { |
2438 visit(link.head); | 2438 visit(link.head); |
2439 } | 2439 } |
2440 } | 2440 } |
2441 | 2441 |
2442 visitOperator(Operator node) { | 2442 visitOperator(Operator node) { |
2443 unimplemented(node, 'operator'); | 2443 unimplemented(node, 'operator'); |
2444 } | 2444 } |
2445 | 2445 |
| 2446 visitRethrow(Rethrow node) { |
| 2447 if (!inCatchBlock) { |
| 2448 error(node, MessageKind.THROW_WITHOUT_EXPRESSION); |
| 2449 } |
| 2450 } |
| 2451 |
2446 visitReturn(Return node) { | 2452 visitReturn(Return node) { |
2447 if (node.isRedirectingFactoryBody) { | 2453 if (node.isRedirectingFactoryBody) { |
2448 handleRedirectingFactoryBody(node); | 2454 handleRedirectingFactoryBody(node); |
2449 } else { | 2455 } else { |
2450 visit(node.expression); | 2456 visit(node.expression); |
2451 } | 2457 } |
2452 } | 2458 } |
2453 | 2459 |
2454 void handleRedirectingFactoryBody(Return node) { | 2460 void handleRedirectingFactoryBody(Return node) { |
2455 final isSymbolConstructor = enclosingElement == compiler.symbolConstructor; | 2461 final isSymbolConstructor = enclosingElement == compiler.symbolConstructor; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2488 world.registerInstantiatedClass( | 2494 world.registerInstantiatedClass( |
2489 redirectionTarget.enclosingElement.declaration, mapping); | 2495 redirectionTarget.enclosingElement.declaration, mapping); |
2490 if (isSymbolConstructor) { | 2496 if (isSymbolConstructor) { |
2491 // Make sure that collection_dev.Symbol.validated is registered. | 2497 // Make sure that collection_dev.Symbol.validated is registered. |
2492 assert(invariant(node, compiler.symbolValidatedConstructor != null)); | 2498 assert(invariant(node, compiler.symbolValidatedConstructor != null)); |
2493 world.registerStaticUse(compiler.symbolValidatedConstructor); | 2499 world.registerStaticUse(compiler.symbolValidatedConstructor); |
2494 } | 2500 } |
2495 } | 2501 } |
2496 | 2502 |
2497 visitThrow(Throw node) { | 2503 visitThrow(Throw node) { |
2498 if (!inCatchBlock && node.expression == null) { | 2504 // We don't know ahead of time whether we will need the throw in a |
2499 error(node, MessageKind.THROW_WITHOUT_EXPRESSION); | 2505 // statement context or an expression context, so we register both |
2500 } | 2506 // here, even though we may not need ThrowExpression. |
2501 // We don't know ahead of time whether we will need the throw in a statement | |
2502 // context or an expression context, so we register both here, even though | |
2503 // we may not need ThrowExpression. | |
2504 compiler.backend.registerWrapException(mapping); | 2507 compiler.backend.registerWrapException(mapping); |
2505 compiler.backend.registerThrowExpression(mapping); | 2508 compiler.backend.registerThrowExpression(mapping); |
2506 visit(node.expression); | 2509 visit(node.expression); |
2507 } | 2510 } |
2508 | 2511 |
2509 visitVariableDefinitions(VariableDefinitions node) { | 2512 visitVariableDefinitions(VariableDefinitions node) { |
2510 VariableDefinitionsVisitor visitor = | 2513 VariableDefinitionsVisitor visitor = |
2511 new VariableDefinitionsVisitor(compiler, node, this, | 2514 new VariableDefinitionsVisitor(compiler, node, this, |
2512 ElementKind.VARIABLE); | 2515 ElementKind.VARIABLE); |
2513 // Ensure that we set the type of the [VariableListElement] since it depends | 2516 // Ensure that we set the type of the [VariableListElement] since it depends |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3960 return e; | 3963 return e; |
3961 } | 3964 } |
3962 | 3965 |
3963 /// Assumed to be called by [resolveRedirectingFactory]. | 3966 /// Assumed to be called by [resolveRedirectingFactory]. |
3964 Element visitReturn(Return node) { | 3967 Element visitReturn(Return node) { |
3965 Node expression = node.expression; | 3968 Node expression = node.expression; |
3966 return finishConstructorReference(visit(expression), | 3969 return finishConstructorReference(visit(expression), |
3967 expression, expression); | 3970 expression, expression); |
3968 } | 3971 } |
3969 } | 3972 } |
OLD | NEW |