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

Side by Side 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 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 interface TreeElements { 5 interface TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 } 8 }
9 9
10 class TreeElementMapping implements TreeElements { 10 class TreeElementMapping implements TreeElements {
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 837
838 visitNamedArgument(NamedArgument node) { 838 visitNamedArgument(NamedArgument node) {
839 visit(node.expression); 839 visit(node.expression);
840 } 840 }
841 841
842 visitSwitchStatement(SwitchStatement node) { 842 visitSwitchStatement(SwitchStatement node) {
843 compiler.unimplemented('switch', node: node); 843 compiler.unimplemented('switch', node: node);
844 } 844 }
845 845
846 visitTryStatement(TryStatement node) { 846 visitTryStatement(TryStatement node) {
847 compiler.unimplemented('try', node: node); 847 visit(node.tryBlock);
848 if (node.catchBlocks.isEmpty() && node.finallyBlock == null) {
849 error(node, MessageKind.NO_CATCH_NOR_FINALLY);
ahe 2012/02/07 19:10:35 The precise location here is: node.getEndToken.ne
ngeoffray 2012/02/08 09:52:23 Added a TODO because there is no API for compiler
ahe 2012/02/08 10:19:27 Please file a bug and assign it to me. Cheers, Pe
ngeoffray 2012/02/08 10:23:21 Done: http://code.google.com/p/dart/issues/detail?
ahe 2012/02/08 10:27:12 Thank you. I can see that you put the issue number
850 }
851 visit(node.catchBlocks);
852 visit(node.finallyBlock);
848 } 853 }
849 854
850 visitCatchBlock(CatchBlock node) { 855 visitCatchBlock(CatchBlock node) {
851 compiler.unimplemented('catch', node: node); 856 Scope scope = new BlockScope(context);
857 if (node.formals.isEmpty()) {
858 error(node, MessageKind.EMPTY_CATCH_DECLARATION);
859 } else if (!node.formals.nodes.tail.isEmpty()
860 && !node.formals.nodes.tail.tail.isEmpty()) {
861 error(node.formals.nodes.tail.tail.head,
ahe 2012/02/07 19:10:35 } else if (!node.formals.nodes.tail.isEmpty()) {
ngeoffray 2012/02/08 09:52:23 Done.
862 MessageKind.TOO_MANY_CATCH_DECLARATIONS);
863 }
864 visitIn(node.formals, scope);
865 visitIn(node.block, scope);
852 } 866 }
853 867
854 visitTypedef(Typedef node) { 868 visitTypedef(Typedef node) {
855 compiler.unimplemented('typedef', node: node); 869 compiler.unimplemented('typedef', node: node);
856 } 870 }
857 } 871 }
858 872
859 class ClassResolverVisitor extends AbstractVisitor<Type> { 873 class ClassResolverVisitor extends AbstractVisitor<Type> {
860 Compiler compiler; 874 Compiler compiler;
861 Scope context; 875 Scope context;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 class TopScope extends Scope { 1179 class TopScope extends Scope {
1166 LibraryElement get library() => element; 1180 LibraryElement get library() => element;
1167 1181
1168 TopScope(LibraryElement library) : super(null, library); 1182 TopScope(LibraryElement library) : super(null, library);
1169 Element lookup(SourceString name) => library.find(name); 1183 Element lookup(SourceString name) => library.find(name);
1170 1184
1171 Element add(Element element) { 1185 Element add(Element element) {
1172 throw "Cannot add an element in the top scope"; 1186 throw "Cannot add an element in the top scope";
1173 } 1187 }
1174 } 1188 }
OLDNEW
« no previous file with comments | « frog/leg/frog_leg.dart ('k') | frog/leg/ssa/bailout.dart » ('j') | frog/leg/ssa/bailout.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698