OLD | NEW |
---|---|
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 Loading... | |
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 Element assertMethod; | 132 Element assertMethod; |
132 Element identicalFunction; | 133 Element identicalFunction; |
133 Element functionApplyMethod; | 134 Element functionApplyMethod; |
134 | 135 |
135 Element get currentElement => _currentElement; | 136 Element get currentElement => _currentElement; |
136 withCurrentElement(Element element, f()) { | 137 withCurrentElement(Element element, f()) { |
137 Element old = currentElement; | 138 Element old = currentElement; |
138 _currentElement = element; | 139 _currentElement = element; |
139 try { | 140 try { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 ConstantHandler constantHandler; | 179 ConstantHandler constantHandler; |
179 EnqueueTask enqueuer; | 180 EnqueueTask enqueuer; |
180 | 181 |
181 static const SourceString MAIN = const SourceString('main'); | 182 static const SourceString MAIN = const SourceString('main'); |
182 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); | 183 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); |
183 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); | 184 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); |
184 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); | 185 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); |
185 static const SourceString START_ROOT_ISOLATE = | 186 static const SourceString START_ROOT_ISOLATE = |
186 const SourceString('startRootIsolate'); | 187 const SourceString('startRootIsolate'); |
187 bool enabledNoSuchMethod = false; | 188 bool enabledNoSuchMethod = false; |
188 bool enabledRuntimeType = false; | |
189 bool enabledFunctionApply = false; | 189 bool enabledFunctionApply = false; |
190 | 190 |
191 bool _enabledRuntimeType = false; | |
ngeoffray
2012/10/31 10:33:03
Why private? I'd prefer to have it consistent with
karlklose
2012/10/31 13:01:18
I have a change to implement the runtime cache to
| |
192 bool _needsRuntimeTypeCache = false; | |
193 | |
194 void enableRuntimeTypeFunction() { | |
195 _enabledRuntimeType = true; | |
196 enableRuntimeTypeCache(); | |
197 } | |
198 | |
199 void enableRuntimeTypeCache() { | |
200 _needsRuntimeTypeCache = true; | |
201 } | |
202 | |
203 bool get enabledRuntimeType => _enabledRuntimeType; | |
204 bool needsRuntimeTypeCache() => _needsRuntimeTypeCache; | |
205 | |
191 Stopwatch progress; | 206 Stopwatch progress; |
192 | 207 |
193 static const int PHASE_SCANNING = 0; | 208 static const int PHASE_SCANNING = 0; |
194 static const int PHASE_RESOLVING = 1; | 209 static const int PHASE_RESOLVING = 1; |
195 static const int PHASE_COMPILING = 2; | 210 static const int PHASE_COMPILING = 2; |
196 int phase; | 211 int phase; |
197 | 212 |
198 bool compilationFailed = false; | 213 bool compilationFailed = false; |
199 | 214 |
200 bool hasCrashed = false; | 215 bool hasCrashed = false; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 return result; | 401 return result; |
387 } | 402 } |
388 objectClass = lookupSpecialClass(const SourceString('Object')); | 403 objectClass = lookupSpecialClass(const SourceString('Object')); |
389 boolClass = lookupSpecialClass(const SourceString('bool')); | 404 boolClass = lookupSpecialClass(const SourceString('bool')); |
390 numClass = lookupSpecialClass(const SourceString('num')); | 405 numClass = lookupSpecialClass(const SourceString('num')); |
391 intClass = lookupSpecialClass(const SourceString('int')); | 406 intClass = lookupSpecialClass(const SourceString('int')); |
392 doubleClass = lookupSpecialClass(const SourceString('double')); | 407 doubleClass = lookupSpecialClass(const SourceString('double')); |
393 stringClass = lookupSpecialClass(const SourceString('String')); | 408 stringClass = lookupSpecialClass(const SourceString('String')); |
394 functionClass = lookupSpecialClass(const SourceString('Function')); | 409 functionClass = lookupSpecialClass(const SourceString('Function')); |
395 listClass = lookupSpecialClass(const SourceString('List')); | 410 listClass = lookupSpecialClass(const SourceString('List')); |
411 typeClass = lookupSpecialClass(const SourceString('Type')); | |
396 mapClass = lookupSpecialClass(const SourceString('Map')); | 412 mapClass = lookupSpecialClass(const SourceString('Map')); |
397 closureClass = lookupSpecialClass(const SourceString('Closure')); | 413 closureClass = lookupSpecialClass(const SourceString('Closure')); |
398 dynamicClass = lookupSpecialClass(const SourceString('Dynamic_')); | 414 dynamicClass = lookupSpecialClass(const SourceString('Dynamic_')); |
399 nullClass = lookupSpecialClass(const SourceString('Null')); | 415 nullClass = lookupSpecialClass(const SourceString('Null')); |
400 types = new Types(this, dynamicClass); | 416 types = new Types(this, dynamicClass); |
401 if (!coreLibValid) { | 417 if (!coreLibValid) { |
402 cancel('core library does not contain required classes'); | 418 cancel('core library does not contain required classes'); |
403 } | 419 } |
404 } | 420 } |
405 | 421 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 907 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
892 // information on assertion errors. | 908 // information on assertion errors. |
893 if (condition is Function){ | 909 if (condition is Function){ |
894 condition = condition(); | 910 condition = condition(); |
895 } | 911 } |
896 if (spannable == null || !condition) { | 912 if (spannable == null || !condition) { |
897 throw new SpannableAssertionFailure(spannable, message); | 913 throw new SpannableAssertionFailure(spannable, message); |
898 } | 914 } |
899 return true; | 915 return true; |
900 } | 916 } |
OLD | NEW |