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 | 5 |
6 /** | 6 /** |
7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not |
8 * compiled. | 8 * compiled. |
9 */ | 9 */ |
10 const bool REPORT_EXCESS_RESOLUTION = false; | 10 const bool REPORT_EXCESS_RESOLUTION = false; |
(...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 Element assertMethod; | 131 Element assertMethod; |
131 Element identicalFunction; | 132 Element identicalFunction; |
132 | 133 |
133 Element get currentElement => _currentElement; | 134 Element get currentElement => _currentElement; |
134 withCurrentElement(Element element, f()) { | 135 withCurrentElement(Element element, f()) { |
135 Element old = currentElement; | 136 Element old = currentElement; |
136 _currentElement = element; | 137 _currentElement = element; |
137 try { | 138 try { |
138 return f(); | 139 return f(); |
139 } on CompilerCancelledException catch (ex) { | 140 } on CompilerCancelledException catch (ex) { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return result; | 348 return result; |
348 } | 349 } |
349 objectClass = lookupSpecialClass(const SourceString('Object')); | 350 objectClass = lookupSpecialClass(const SourceString('Object')); |
350 boolClass = lookupSpecialClass(const SourceString('bool')); | 351 boolClass = lookupSpecialClass(const SourceString('bool')); |
351 numClass = lookupSpecialClass(const SourceString('num')); | 352 numClass = lookupSpecialClass(const SourceString('num')); |
352 intClass = lookupSpecialClass(const SourceString('int')); | 353 intClass = lookupSpecialClass(const SourceString('int')); |
353 doubleClass = lookupSpecialClass(const SourceString('double')); | 354 doubleClass = lookupSpecialClass(const SourceString('double')); |
354 stringClass = lookupSpecialClass(const SourceString('String')); | 355 stringClass = lookupSpecialClass(const SourceString('String')); |
355 functionClass = lookupSpecialClass(const SourceString('Function')); | 356 functionClass = lookupSpecialClass(const SourceString('Function')); |
356 listClass = lookupSpecialClass(const SourceString('List')); | 357 listClass = lookupSpecialClass(const SourceString('List')); |
| 358 typeClass = lookupSpecialClass(const SourceString('Type')); |
357 closureClass = lookupSpecialClass(const SourceString('Closure')); | 359 closureClass = lookupSpecialClass(const SourceString('Closure')); |
358 dynamicClass = lookupSpecialClass(const SourceString('Dynamic_')); | 360 dynamicClass = lookupSpecialClass(const SourceString('Dynamic_')); |
359 nullClass = lookupSpecialClass(const SourceString('Null')); | 361 nullClass = lookupSpecialClass(const SourceString('Null')); |
360 types = new Types(this, dynamicClass); | 362 types = new Types(this, dynamicClass); |
361 if (!coreLibValid) { | 363 if (!coreLibValid) { |
362 cancel('core library does not contain required classes'); | 364 cancel('core library does not contain required classes'); |
363 } | 365 } |
364 } | 366 } |
365 | 367 |
366 void scanBuiltinLibraries() { | 368 void scanBuiltinLibraries() { |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 * information in the generated error message. | 852 * information in the generated error message. |
851 */ | 853 */ |
852 bool invariant(Spannable spannable, var condition, {String message: null}) { | 854 bool invariant(Spannable spannable, var condition, {String message: null}) { |
853 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 855 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
854 // information on assertion errors. | 856 // information on assertion errors. |
855 if (condition is Function){ | 857 if (condition is Function){ |
856 condition = condition(); | 858 condition = condition(); |
857 } | 859 } |
858 return spannable != null && condition; | 860 return spannable != null && condition; |
859 } | 861 } |
OLD | NEW |