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

Side by Side Diff: lib/compiler/implementation/resolver.dart

Issue 10540052: Only generate assert in checked mode. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 Type getType(TypeAnnotation annotation); 8 Type getType(TypeAnnotation annotation);
9 } 9 }
10 10
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 mapping.setSelector(node, Selector.INDEX); 1045 mapping.setSelector(node, Selector.INDEX);
1046 } else if (node.isPropertyAccess) { 1046 } else if (node.isPropertyAccess) {
1047 mapping.setSelector(node, Selector.GETTER); 1047 mapping.setSelector(node, Selector.GETTER);
1048 } else { 1048 } else {
1049 handleArguments(node); 1049 handleArguments(node);
1050 } 1050 }
1051 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { 1051 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) {
1052 AbstractFieldElement field = target; 1052 AbstractFieldElement field = target;
1053 target = field.getter; 1053 target = field.getter;
1054 } 1054 }
1055 if (target == compiler.assertMethod && !node.isCall) {
kasperl 2012/06/08 05:34:05 ===
ngeoffray 2012/06/08 09:40:58 Done.
1056 // We can only use assert by calling it.
1057 if (!inInstanceContext) error(node, MessageKind.CANNOT_RESOLVE, [node]);
ahe 2012/06/08 07:59:14 I'm not sure about this error message. I think it
ngeoffray 2012/06/08 09:40:58 Done.
1058 target = null;
1059 }
1055 // TODO(ngeoffray): Warn if target is null and the send is 1060 // TODO(ngeoffray): Warn if target is null and the send is
1056 // unqualified. 1061 // unqualified.
1057 useElement(node, target); 1062 useElement(node, target);
1058 if (node.isPropertyAccess) return target; 1063 if (node.isPropertyAccess) return target;
1059 } 1064 }
1060 1065
1061 visitSendSet(SendSet node) { 1066 visitSendSet(SendSet node) {
1062 Element target = resolveSend(node); 1067 Element target = resolveSend(node);
1063 Element setter = null; 1068 Element setter = null;
1064 Element getter = null; 1069 Element getter = null;
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 2009
2005 TopScope(LibraryElement library) : super(null, library); 2010 TopScope(LibraryElement library) : super(null, library);
2006 Element lookup(SourceString name) { 2011 Element lookup(SourceString name) {
2007 return library.find(name); 2012 return library.find(name);
2008 } 2013 }
2009 2014
2010 Element add(Element newElement) { 2015 Element add(Element newElement) {
2011 throw "Cannot add an element in the top scope"; 2016 throw "Cannot add an element in the top scope";
2012 } 2017 }
2013 } 2018 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698