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

Unified Diff: frog/leg/resolver.dart

Issue 9351020: Implement try/catch without finally, and without type checks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frog/leg/frog_leg.dart ('k') | frog/leg/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/resolver.dart
===================================================================
--- frog/leg/resolver.dart (revision 4024)
+++ frog/leg/resolver.dart (working copy)
@@ -856,11 +856,28 @@
}
visitTryStatement(TryStatement node) {
- unimplemented(node, 'try');
+ visit(node.tryBlock);
+ if (node.catchBlocks.isEmpty() && node.finallyBlock == null) {
+ // TODO(ngeoffray): The precise location is
+ // node.getEndtoken.next. Adjust when issue #1581 is fixed.
+ error(node, MessageKind.NO_CATCH_NOR_FINALLY);
+ }
+ visit(node.catchBlocks);
+ visit(node.finallyBlock);
}
visitCatchBlock(CatchBlock node) {
- unimplemented(node, 'catch');
+ Scope scope = new BlockScope(context);
+ if (node.formals.isEmpty()) {
+ error(node, MessageKind.EMPTY_CATCH_DECLARATION);
+ } else if (!node.formals.nodes.tail.isEmpty()
+ && !node.formals.nodes.tail.tail.isEmpty()) {
+ for (Node extra in node.formals.nodes.tail.tail) {
+ error(extra, MessageKind.EXTRA_CATCH_DECLARATION);
+ }
+ }
+ visitIn(node.formals, scope);
+ visitIn(node.block, scope);
}
visitTypedef(Typedef node) {
« no previous file with comments | « frog/leg/frog_leg.dart ('k') | frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698