Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 14211008: Add support for rethrow and start treating throw <expr> as an expression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 visitNodeList(NodeList node) { 2433 visitNodeList(NodeList node) {
2434 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { 2434 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) {
2435 visit(link.head); 2435 visit(link.head);
2436 } 2436 }
2437 } 2437 }
2438 2438
2439 visitOperator(Operator node) { 2439 visitOperator(Operator node) {
2440 unimplemented(node, 'operator'); 2440 unimplemented(node, 'operator');
2441 } 2441 }
2442 2442
2443 visitRethrow(Rethrow node) {
2444 if (!inCatchBlock) {
2445 error(node, MessageKind.THROW_WITHOUT_EXPRESSION);
2446 }
2447 }
2448
2443 visitReturn(Return node) { 2449 visitReturn(Return node) {
2444 if (node.isRedirectingFactoryBody) { 2450 if (node.isRedirectingFactoryBody) {
2445 handleRedirectingFactoryBody(node); 2451 handleRedirectingFactoryBody(node);
2446 } else { 2452 } else {
2447 visit(node.expression); 2453 visit(node.expression);
2448 } 2454 }
2449 } 2455 }
2450 2456
2451 void handleRedirectingFactoryBody(Return node) { 2457 void handleRedirectingFactoryBody(Return node) {
2452 final isSymbolConstructor = enclosingElement == compiler.symbolConstructor; 2458 final isSymbolConstructor = enclosingElement == compiler.symbolConstructor;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 world.registerInstantiatedClass( 2491 world.registerInstantiatedClass(
2486 redirectionTarget.enclosingElement.declaration, mapping); 2492 redirectionTarget.enclosingElement.declaration, mapping);
2487 if (isSymbolConstructor) { 2493 if (isSymbolConstructor) {
2488 // Make sure that collection_dev.Symbol.validated is registered. 2494 // Make sure that collection_dev.Symbol.validated is registered.
2489 assert(invariant(node, compiler.symbolValidatedConstructor != null)); 2495 assert(invariant(node, compiler.symbolValidatedConstructor != null));
2490 world.registerStaticUse(compiler.symbolValidatedConstructor); 2496 world.registerStaticUse(compiler.symbolValidatedConstructor);
2491 } 2497 }
2492 } 2498 }
2493 2499
2494 visitThrow(Throw node) { 2500 visitThrow(Throw node) {
2495 if (!inCatchBlock && node.expression == null) { 2501 // We don't know ahead of time whether we will need the throw in a
2496 error(node, MessageKind.THROW_WITHOUT_EXPRESSION); 2502 // statement context or an expression context, so we register both
2497 } 2503 // here, even though we may not need ThrowExpression.
2498 // We don't know ahead of time whether we will need the throw in a statement
2499 // context or an expression context, so we register both here, even though
2500 // we may not need ThrowExpression.
2501 compiler.backend.registerWrapException(mapping); 2504 compiler.backend.registerWrapException(mapping);
2502 compiler.backend.registerThrowExpression(mapping); 2505 compiler.backend.registerThrowExpression(mapping);
2503 visit(node.expression); 2506 visit(node.expression);
2504 } 2507 }
2505 2508
2506 visitVariableDefinitions(VariableDefinitions node) { 2509 visitVariableDefinitions(VariableDefinitions node) {
2507 VariableDefinitionsVisitor visitor = 2510 VariableDefinitionsVisitor visitor =
2508 new VariableDefinitionsVisitor(compiler, node, this, 2511 new VariableDefinitionsVisitor(compiler, node, this,
2509 ElementKind.VARIABLE); 2512 ElementKind.VARIABLE);
2510 // Ensure that we set the type of the [VariableListElement] since it depends 2513 // Ensure that we set the type of the [VariableListElement] since it depends
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after
3957 return e; 3960 return e;
3958 } 3961 }
3959 3962
3960 /// Assumed to be called by [resolveRedirectingFactory]. 3963 /// Assumed to be called by [resolveRedirectingFactory].
3961 Element visitReturn(Return node) { 3964 Element visitReturn(Return node) {
3962 Node expression = node.expression; 3965 Node expression = node.expression;
3963 return finishConstructorReference(visit(expression), 3966 return finishConstructorReference(visit(expression),
3964 expression, expression); 3967 expression, expression);
3965 } 3968 }
3966 } 3969 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698