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

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

Issue 10942028: Support class and typedef literals as expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 ClassElement closureClass; 120 ClassElement closureClass;
121 ClassElement dynamicClass; 121 ClassElement dynamicClass;
122 ClassElement boolClass; 122 ClassElement boolClass;
123 ClassElement numClass; 123 ClassElement numClass;
124 ClassElement intClass; 124 ClassElement intClass;
125 ClassElement doubleClass; 125 ClassElement doubleClass;
126 ClassElement stringClass; 126 ClassElement stringClass;
127 ClassElement functionClass; 127 ClassElement functionClass;
128 ClassElement nullClass; 128 ClassElement nullClass;
129 ClassElement listClass; 129 ClassElement listClass;
130 ClassElement typeClass;
130 ClassElement mapClass; 131 ClassElement mapClass;
131 ClassElement jsInvocationMirrorClass; 132 ClassElement jsInvocationMirrorClass;
132 Element assertMethod; 133 Element assertMethod;
133 Element identicalFunction; 134 Element identicalFunction;
134 Element functionApplyMethod; 135 Element functionApplyMethod;
135 Element invokeOnMethod; 136 Element invokeOnMethod;
136 137
137 Element get currentElement => _currentElement; 138 Element get currentElement => _currentElement;
138 withCurrentElement(Element element, f()) { 139 withCurrentElement(Element element, f()) {
139 Element old = currentElement; 140 Element old = currentElement;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 183
183 static const SourceString MAIN = const SourceString('main'); 184 static const SourceString MAIN = const SourceString('main');
184 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); 185 static const SourceString CALL_OPERATOR_NAME = const SourceString('call');
185 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); 186 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
186 static const int NO_SUCH_METHOD_ARG_COUNT = 1; 187 static const int NO_SUCH_METHOD_ARG_COUNT = 1;
187 static const SourceString INVOKE_ON = const SourceString('invokeOn'); 188 static const SourceString INVOKE_ON = const SourceString('invokeOn');
188 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); 189 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType');
189 static const SourceString START_ROOT_ISOLATE = 190 static const SourceString START_ROOT_ISOLATE =
190 const SourceString('startRootIsolate'); 191 const SourceString('startRootIsolate');
191 bool enabledNoSuchMethod = false; 192 bool enabledNoSuchMethod = false;
192 bool enabledRuntimeType = false;
193 bool enabledFunctionApply = false; 193 bool enabledFunctionApply = false;
194 bool enabledInvokeOn = false; 194 bool enabledInvokeOn = false;
195 195
196 bool _enabledRuntimeType = false;
197 bool _needsRuntimeTypeCache = false;
198
199 void enableRuntimeTypeFunction() {
ahe 2012/11/01 13:55:27 Why do you need this complexity? What is wrong wit
karlklose 2012/11/01 14:34:20 It is not needed anymore. Before making the runtim
200 _enabledRuntimeType = true;
201 enableRuntimeTypeCache();
202 }
203
204 void enableRuntimeTypeCache() {
205 _needsRuntimeTypeCache = true;
206 }
207
208 bool get enabledRuntimeType => _enabledRuntimeType;
209 bool needsRuntimeTypeCache() => _needsRuntimeTypeCache;
210
196 Stopwatch progress; 211 Stopwatch progress;
197 212
198 static const int PHASE_SCANNING = 0; 213 static const int PHASE_SCANNING = 0;
199 static const int PHASE_RESOLVING = 1; 214 static const int PHASE_RESOLVING = 1;
200 static const int PHASE_COMPILING = 2; 215 static const int PHASE_COMPILING = 2;
201 int phase; 216 int phase;
202 217
203 bool compilationFailed = false; 218 bool compilationFailed = false;
204 219
205 bool hasCrashed = false; 220 bool hasCrashed = false;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return result; 411 return result;
397 } 412 }
398 objectClass = lookupSpecialClass(const SourceString('Object')); 413 objectClass = lookupSpecialClass(const SourceString('Object'));
399 boolClass = lookupSpecialClass(const SourceString('bool')); 414 boolClass = lookupSpecialClass(const SourceString('bool'));
400 numClass = lookupSpecialClass(const SourceString('num')); 415 numClass = lookupSpecialClass(const SourceString('num'));
401 intClass = lookupSpecialClass(const SourceString('int')); 416 intClass = lookupSpecialClass(const SourceString('int'));
402 doubleClass = lookupSpecialClass(const SourceString('double')); 417 doubleClass = lookupSpecialClass(const SourceString('double'));
403 stringClass = lookupSpecialClass(const SourceString('String')); 418 stringClass = lookupSpecialClass(const SourceString('String'));
404 functionClass = lookupSpecialClass(const SourceString('Function')); 419 functionClass = lookupSpecialClass(const SourceString('Function'));
405 listClass = lookupSpecialClass(const SourceString('List')); 420 listClass = lookupSpecialClass(const SourceString('List'));
421 typeClass = lookupSpecialClass(const SourceString('Type'));
406 mapClass = lookupSpecialClass(const SourceString('Map')); 422 mapClass = lookupSpecialClass(const SourceString('Map'));
407 jsInvocationMirrorClass = 423 jsInvocationMirrorClass =
408 lookupSpecialClass(const SourceString('JSInvocationMirror')); 424 lookupSpecialClass(const SourceString('JSInvocationMirror'));
409 closureClass = lookupSpecialClass(const SourceString('Closure')); 425 closureClass = lookupSpecialClass(const SourceString('Closure'));
410 dynamicClass = lookupSpecialClass(const SourceString('Dynamic_')); 426 dynamicClass = lookupSpecialClass(const SourceString('Dynamic_'));
411 nullClass = lookupSpecialClass(const SourceString('Null')); 427 nullClass = lookupSpecialClass(const SourceString('Null'));
412 types = new Types(this, dynamicClass); 428 types = new Types(this, dynamicClass);
413 if (!coreLibValid) { 429 if (!coreLibValid) {
414 cancel('core library does not contain required classes'); 430 cancel('core library does not contain required classes');
415 } 431 }
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 // TODO(johnniwinther): Use [spannable] and [message] to provide better 922 // TODO(johnniwinther): Use [spannable] and [message] to provide better
907 // information on assertion errors. 923 // information on assertion errors.
908 if (condition is Function){ 924 if (condition is Function){
909 condition = condition(); 925 condition = condition();
910 } 926 }
911 if (spannable == null || !condition) { 927 if (spannable == null || !condition) {
912 throw new SpannableAssertionFailure(spannable, message); 928 throw new SpannableAssertionFailure(spannable, message);
913 } 929 }
914 return true; 930 return true;
915 } 931 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698