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

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
« no previous file with comments | « frog/leg/frog_leg.dart ('k') | frog/leg/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 849
850 visitNamedArgument(NamedArgument node) { 850 visitNamedArgument(NamedArgument node) {
851 visit(node.expression); 851 visit(node.expression);
852 } 852 }
853 853
854 visitSwitchStatement(SwitchStatement node) { 854 visitSwitchStatement(SwitchStatement node) {
855 unimplemented(node, 'switch'); 855 unimplemented(node, 'switch');
856 } 856 }
857 857
858 visitTryStatement(TryStatement node) { 858 visitTryStatement(TryStatement node) {
859 unimplemented(node, 'try'); 859 visit(node.tryBlock);
860 if (node.catchBlocks.isEmpty() && node.finallyBlock == null) {
861 // TODO(ngeoffray): The precise location is
862 // node.getEndtoken.next. Adjust when issue #1581 is fixed.
863 error(node, MessageKind.NO_CATCH_NOR_FINALLY);
864 }
865 visit(node.catchBlocks);
866 visit(node.finallyBlock);
860 } 867 }
861 868
862 visitCatchBlock(CatchBlock node) { 869 visitCatchBlock(CatchBlock node) {
863 unimplemented(node, 'catch'); 870 Scope scope = new BlockScope(context);
871 if (node.formals.isEmpty()) {
872 error(node, MessageKind.EMPTY_CATCH_DECLARATION);
873 } else if (!node.formals.nodes.tail.isEmpty()
874 && !node.formals.nodes.tail.tail.isEmpty()) {
875 for (Node extra in node.formals.nodes.tail.tail) {
876 error(extra, MessageKind.EXTRA_CATCH_DECLARATION);
877 }
878 }
879 visitIn(node.formals, scope);
880 visitIn(node.block, scope);
864 } 881 }
865 882
866 visitTypedef(Typedef node) { 883 visitTypedef(Typedef node) {
867 unimplemented(node, 'typedef'); 884 unimplemented(node, 'typedef');
868 } 885 }
869 } 886 }
870 887
871 class ClassResolverVisitor extends CommonResolverVisitor<Type> { 888 class ClassResolverVisitor extends CommonResolverVisitor<Type> {
872 Scope context; 889 Scope context;
873 890
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 class TopScope extends Scope { 1164 class TopScope extends Scope {
1148 LibraryElement get library() => element; 1165 LibraryElement get library() => element;
1149 1166
1150 TopScope(LibraryElement library) : super(null, library); 1167 TopScope(LibraryElement library) : super(null, library);
1151 Element lookup(SourceString name) => library.find(name); 1168 Element lookup(SourceString name) => library.find(name);
1152 1169
1153 Element add(Element element) { 1170 Element add(Element element) {
1154 throw "Cannot add an element in the top scope"; 1171 throw "Cannot add an element in the top scope";
1155 } 1172 }
1156 } 1173 }
OLDNEW
« 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