| 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 * A function element that represents a closure call. The signature is copied | 6 * A function element that represents a closure call. The signature is copied |
| 7 * from the given element. | 7 * from the given element. |
| 8 */ | 8 */ |
| 9 class ClosureInvocationElement extends FunctionElement { | 9 class ClosureInvocationElement extends FunctionElement { |
| 10 ClosureInvocationElement(SourceString name, | 10 ClosureInvocationElement(SourceString name, |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 void generateTypeTest(ClassElement element), | 691 void generateTypeTest(ClassElement element), |
| 692 Set<Element> alreadyGenerated) { | 692 Set<Element> alreadyGenerated) { |
| 693 for (DartType interfaceType in cls.interfaces) { | 693 for (DartType interfaceType in cls.interfaces) { |
| 694 Element element = interfaceType.element; | 694 Element element = interfaceType.element; |
| 695 if (!alreadyGenerated.contains(element) && | 695 if (!alreadyGenerated.contains(element) && |
| 696 compiler.codegenWorld.checkedClasses.contains(element)) { | 696 compiler.codegenWorld.checkedClasses.contains(element)) { |
| 697 alreadyGenerated.add(element); | 697 alreadyGenerated.add(element); |
| 698 generateTypeTest(element); | 698 generateTypeTest(element); |
| 699 } | 699 } |
| 700 generateInterfacesIsTests(element, generateTypeTest, alreadyGenerated); | 700 generateInterfacesIsTests(element, generateTypeTest, alreadyGenerated); |
| 701 |
| 702 // Since [element] is implemented by [cls], we need to also emit |
| 703 // is checks for the superclass and its supertypes. |
| 704 ClassElement superclass = element.superclass; |
| 705 if (!alreadyGenerated.contains(superclass) && |
| 706 compiler.codegenWorld.checkedClasses.contains(superclass)) { |
| 707 alreadyGenerated.add(superclass); |
| 708 generateTypeTest(superclass); |
| 709 } |
| 710 generateInterfacesIsTests(superclass, generateTypeTest, alreadyGenerated); |
| 701 } | 711 } |
| 702 } | 712 } |
| 703 | 713 |
| 704 void emitClasses(CodeBuffer buffer) { | 714 void emitClasses(CodeBuffer buffer) { |
| 705 Set<ClassElement> instantiatedClasses = | 715 Set<ClassElement> instantiatedClasses = |
| 706 compiler.codegenWorld.instantiatedClasses; | 716 compiler.codegenWorld.instantiatedClasses; |
| 707 Set<ClassElement> neededClasses = | 717 Set<ClassElement> neededClasses = |
| 708 new Set<ClassElement>.from(instantiatedClasses); | 718 new Set<ClassElement>.from(instantiatedClasses); |
| 709 for (ClassElement element in instantiatedClasses) { | 719 for (ClassElement element in instantiatedClasses) { |
| 710 for (ClassElement superclass = element.superclass; | 720 for (ClassElement superclass = element.superclass; |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 const String HOOKS_API_USAGE = """ | 1347 const String HOOKS_API_USAGE = """ |
| 1338 // Generated by dart2js, the Dart to JavaScript compiler. | 1348 // Generated by dart2js, the Dart to JavaScript compiler. |
| 1339 // The code supports the following hooks: | 1349 // The code supports the following hooks: |
| 1340 // dartPrint(message) - if this function is defined it is called | 1350 // dartPrint(message) - if this function is defined it is called |
| 1341 // instead of the Dart [print] method. | 1351 // instead of the Dart [print] method. |
| 1342 // dartMainRunner(main) - if this function is defined, the Dart [main] | 1352 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 1343 // method will not be invoked directly. | 1353 // method will not be invoked directly. |
| 1344 // Instead, a closure that will invoke [main] is | 1354 // Instead, a closure that will invoke [main] is |
| 1345 // passed to [dartMainRunner]. | 1355 // passed to [dartMainRunner]. |
| 1346 """; | 1356 """; |
| OLD | NEW |