| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 void registerInstantiation(InterfaceType type); | 248 void registerInstantiation(InterfaceType type); |
| 249 | 249 |
| 250 void registerGetOfStaticFunction(FunctionElement element); | 250 void registerGetOfStaticFunction(FunctionElement element); |
| 251 } | 251 } |
| 252 | 252 |
| 253 abstract class Backend { | 253 abstract class Backend { |
| 254 final Compiler compiler; | 254 final Compiler compiler; |
| 255 | 255 |
| 256 Backend(this.compiler); | 256 Backend(this.compiler); |
| 257 | 257 |
| 258 /// Returns true if the backend supports reflection. |
| 259 bool get supportsReflection; |
| 260 |
| 258 /// The [ConstantSystem] used to interpret compile-time constants for this | 261 /// The [ConstantSystem] used to interpret compile-time constants for this |
| 259 /// backend. | 262 /// backend. |
| 260 ConstantSystem get constantSystem; | 263 ConstantSystem get constantSystem; |
| 261 | 264 |
| 262 /// The constant environment for the backend interpretation of compile-time | 265 /// The constant environment for the backend interpretation of compile-time |
| 263 /// constants. | 266 /// constants. |
| 264 BackendConstantEnvironment get constants; | 267 BackendConstantEnvironment get constants; |
| 265 | 268 |
| 266 /// The compiler task responsible for the compilation of constants for both | 269 /// The compiler task responsible for the compilation of constants for both |
| 267 /// the frontend and the backend. | 270 /// the frontend and the backend. |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 | 1365 |
| 1363 chainCount++; | 1366 chainCount++; |
| 1364 if (chainCount > chainLimit) { | 1367 if (chainCount > chainLimit) { |
| 1365 // Assume there are more import chains. | 1368 // Assume there are more import chains. |
| 1366 importChains.add('...'); | 1369 importChains.add('...'); |
| 1367 return false; | 1370 return false; |
| 1368 } | 1371 } |
| 1369 return true; | 1372 return true; |
| 1370 }); | 1373 }); |
| 1371 | 1374 |
| 1372 if (const bool.fromEnvironment("dart2js.use.new.emitter")) { | 1375 if (!backend.supportsReflection) { |
| 1373 reportError(NO_LOCATION_SPANNABLE, | 1376 reportError(NO_LOCATION_SPANNABLE, |
| 1374 MessageKind.MIRRORS_LIBRARY_NEW_EMITTER); | 1377 MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND); |
| 1375 } else { | 1378 } else { |
| 1376 reportWarning(NO_LOCATION_SPANNABLE, | 1379 reportWarning(NO_LOCATION_SPANNABLE, |
| 1377 MessageKind.IMPORT_EXPERIMENTAL_MIRRORS, | 1380 MessageKind.IMPORT_EXPERIMENTAL_MIRRORS, |
| 1378 {'importChain': importChains.join( | 1381 {'importChain': importChains.join( |
| 1379 MessageKind.IMPORT_EXPERIMENTAL_MIRRORS_PADDING)}); | 1382 MessageKind.IMPORT_EXPERIMENTAL_MIRRORS_PADDING)}); |
| 1380 } | 1383 } |
| 1381 } | 1384 } |
| 1382 | 1385 |
| 1383 functionClass.ensureResolved(this); | 1386 functionClass.ensureResolved(this); |
| 1384 functionApplyMethod = functionClass.lookupLocalMember('apply'); | 1387 functionApplyMethod = functionClass.lookupLocalMember('apply'); |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2496 InterfaceType streamType([DartType elementType]) { | 2499 InterfaceType streamType([DartType elementType]) { |
| 2497 InterfaceType type = streamClass.computeType(compiler); | 2500 InterfaceType type = streamClass.computeType(compiler); |
| 2498 if (elementType == null) { | 2501 if (elementType == null) { |
| 2499 return streamClass.rawType; | 2502 return streamClass.rawType; |
| 2500 } | 2503 } |
| 2501 return type.createInstantiation([elementType]); | 2504 return type.createInstantiation([elementType]); |
| 2502 } | 2505 } |
| 2503 } | 2506 } |
| 2504 | 2507 |
| 2505 typedef void InternalErrorFunction(Spannable location, String message); | 2508 typedef void InternalErrorFunction(Spannable location, String message); |
| OLD | NEW |