Chromium Code Reviews| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 | 355 |
| 356 /// Call this to register that a static function has been closurized. | 356 /// Call this to register that a static function has been closurized. |
| 357 void registerGetOfStaticFunction(Enqueuer enqueuer) {} | 357 void registerGetOfStaticFunction(Enqueuer enqueuer) {} |
| 358 | 358 |
| 359 /** | 359 /** |
| 360 * Call this to register that the [:runtimeType:] property has been accessed. | 360 * Call this to register that the [:runtimeType:] property has been accessed. |
| 361 */ | 361 */ |
| 362 void registerRuntimeType(Enqueuer enqueuer, Registry registry) {} | 362 void registerRuntimeType(Enqueuer enqueuer, Registry registry) {} |
| 363 | 363 |
| 364 /** | 364 /** |
| 365 * Call this to register a `noSuchMethod` implementation. | |
| 366 */ | |
| 367 void registerNoSuchMethod(Element noSuchMethodElement, Enqueuer enqueuer) { | |
|
Johnni Winther
2015/03/16 14:20:43
Leave the default implementation empty. Only the J
Harry Terkelsen
2015/03/17 21:43:11
Done.
| |
| 368 if (compiler.enabledNoSuchMethod) return; | |
| 369 if (isDefaultNoSuchMethodImplementation(noSuchMethodElement)) return; | |
| 370 enableNoSuchMethod(enqueuer); | |
| 371 compiler.enabledNoSuchMethod = true; | |
|
floitsch
2015/03/13 15:51:49
I would have expected this to be in `enableNoSuchM
Johnni Winther
2015/03/16 14:20:43
Add a TODO on Compiler.enabledNoSuchMethod to move
Harry Terkelsen
2015/03/17 21:43:11
It is just a flag that says if noSuchMethod suppor
Harry Terkelsen
2015/03/17 21:43:11
I just moved it
| |
| 372 } | |
| 373 | |
| 374 /** | |
| 365 * Call this method to enable [noSuchMethod] handling in the | 375 * Call this method to enable [noSuchMethod] handling in the |
| 366 * backend. | 376 * backend. |
| 367 */ | 377 */ |
| 368 void enableNoSuchMethod(Element context, Enqueuer enqueuer) { | 378 void enableNoSuchMethod(Enqueuer enqueuer) { |
|
floitsch
2015/03/13 15:51:49
Can we remove this method? (or make it private)
Harry Terkelsen
2015/03/17 21:43:11
Done.
| |
| 369 enqueuer.registerInvocation(compiler.noSuchMethodSelector); | 379 enqueuer.registerInvocation(compiler.noSuchMethodSelector); |
| 370 } | 380 } |
| 371 | 381 |
| 372 /// Call this method to enable support for isolates. | 382 /// Call this method to enable support for isolates. |
| 373 void enableIsolateSupport(Enqueuer enqueuer) {} | 383 void enableIsolateSupport(Enqueuer enqueuer) {} |
| 374 | 384 |
| 375 void registerRequiredType(DartType type, Element enclosingElement) {} | 385 void registerRequiredType(DartType type, Element enclosingElement) {} |
| 376 void registerClassUsingVariableExpression(ClassElement cls) {} | 386 void registerClassUsingVariableExpression(ClassElement cls) {} |
| 377 | 387 |
| 378 void registerConstSymbol(String name, Registry registry) {} | 388 void registerConstSymbol(String name, Registry registry) {} |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1620 | 1630 |
| 1621 if (stopAfterTypeInference) return; | 1631 if (stopAfterTypeInference) return; |
| 1622 | 1632 |
| 1623 log('Compiling...'); | 1633 log('Compiling...'); |
| 1624 phase = PHASE_COMPILING; | 1634 phase = PHASE_COMPILING; |
| 1625 // TODO(johnniwinther): Move these to [CodegenEnqueuer]. | 1635 // TODO(johnniwinther): Move these to [CodegenEnqueuer]. |
| 1626 if (hasIsolateSupport) { | 1636 if (hasIsolateSupport) { |
| 1627 backend.enableIsolateSupport(enqueuer.codegen); | 1637 backend.enableIsolateSupport(enqueuer.codegen); |
| 1628 } | 1638 } |
| 1629 if (enabledNoSuchMethod) { | 1639 if (enabledNoSuchMethod) { |
| 1630 backend.enableNoSuchMethod(null, enqueuer.codegen); | 1640 backend.enableNoSuchMethod(enqueuer.codegen); |
| 1631 } | 1641 } |
| 1632 if (compileAll) { | 1642 if (compileAll) { |
| 1633 libraryLoader.libraries.forEach((LibraryElement library) { | 1643 libraryLoader.libraries.forEach((LibraryElement library) { |
| 1634 fullyEnqueueLibrary(library, enqueuer.codegen); | 1644 fullyEnqueueLibrary(library, enqueuer.codegen); |
| 1635 }); | 1645 }); |
| 1636 } | 1646 } |
| 1637 processQueue(enqueuer.codegen, mainFunction); | 1647 processQueue(enqueuer.codegen, mainFunction); |
| 1638 enqueuer.codegen.logSummary(log); | 1648 enqueuer.codegen.logSummary(log); |
| 1639 | 1649 |
| 1640 int programSize = backend.assembleProgram(); | 1650 int programSize = backend.assembleProgram(); |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2420 return futureClass.computeType(compiler).createInstantiation([elementType]); | 2430 return futureClass.computeType(compiler).createInstantiation([elementType]); |
| 2421 } | 2431 } |
| 2422 | 2432 |
| 2423 @override | 2433 @override |
| 2424 InterfaceType streamType([DartType elementType = const DynamicType()]) { | 2434 InterfaceType streamType([DartType elementType = const DynamicType()]) { |
| 2425 return streamClass.computeType(compiler).createInstantiation([elementType]); | 2435 return streamClass.computeType(compiler).createInstantiation([elementType]); |
| 2426 } | 2436 } |
| 2427 } | 2437 } |
| 2428 | 2438 |
| 2429 typedef void InternalErrorFunction(Spannable location, String message); | 2439 typedef void InternalErrorFunction(Spannable location, String message); |
| OLD | NEW |