Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: lib/compiler/implementation/js_backend/emitter.dart

Issue 10911006: Collect the types used in is-checks in the resolver phase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // TODO(floitsch): the emitInstanceMember should simply always emit a ',\n'. 567 // TODO(floitsch): the emitInstanceMember should simply always emit a ',\n'.
568 // That does currently not work because the native classes have a different 568 // That does currently not work because the native classes have a different
569 // syntax. 569 // syntax.
570 buffer.add(' super: "$superName"'); 570 buffer.add(' super: "$superName"');
571 emitInstanceMembers(classElement, buffer, true); 571 emitInstanceMembers(classElement, buffer, true);
572 buffer.add('\n};\n\n'); 572 buffer.add('\n};\n\n');
573 } 573 }
574 574
575 void generateTypeTests(ClassElement cls, 575 void generateTypeTests(ClassElement cls,
576 void generateTypeTest(ClassElement element)) { 576 void generateTypeTest(ClassElement element)) {
577 if (compiler.codegenWorld.isChecks.contains(cls)) { 577 if (compiler.codegenWorld.checkedClasses.contains(cls)) {
578 generateTypeTest(cls); 578 generateTypeTest(cls);
579 } 579 }
580 generateInterfacesIsTests(cls, generateTypeTest, new Set<Element>()); 580 generateInterfacesIsTests(cls, generateTypeTest, new Set<Element>());
581 } 581 }
582 582
583 void generateInterfacesIsTests(ClassElement cls, 583 void generateInterfacesIsTests(ClassElement cls,
584 void generateTypeTest(ClassElement element), 584 void generateTypeTest(ClassElement element),
585 Set<Element> alreadyGenerated) { 585 Set<Element> alreadyGenerated) {
586 for (Type interfaceType in cls.interfaces) { 586 for (Type interfaceType in cls.interfaces) {
587 Element element = interfaceType.element; 587 Element element = interfaceType.element;
588 if (!alreadyGenerated.contains(element) && 588 if (!alreadyGenerated.contains(element) &&
589 compiler.codegenWorld.isChecks.contains(element)) { 589 compiler.codegenWorld.checkedClasses.contains(element)) {
590 alreadyGenerated.add(element); 590 alreadyGenerated.add(element);
591 generateTypeTest(element); 591 generateTypeTest(element);
592 } 592 }
593 generateInterfacesIsTests(element, generateTypeTest, alreadyGenerated); 593 generateInterfacesIsTests(element, generateTypeTest, alreadyGenerated);
594 } 594 }
595 } 595 }
596 596
597 void emitClasses(CodeBuffer buffer) { 597 void emitClasses(CodeBuffer buffer) {
598 Set<ClassElement> instantiatedClasses = 598 Set<ClassElement> instantiatedClasses =
599 compiler.codegenWorld.instantiatedClasses; 599 compiler.codegenWorld.instantiatedClasses;
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 sourceName = token.slowToString(); 1167 sourceName = token.slowToString();
1168 } 1168 }
1169 int totalOffset = bufferOffset + offset; 1169 int totalOffset = bufferOffset + offset;
1170 sourceMapBuilder.addMapping( 1170 sourceMapBuilder.addMapping(
1171 sourceFile, token.charOffset, sourceName, totalOffset); 1171 sourceFile, token.charOffset, sourceName, totalOffset);
1172 }); 1172 });
1173 } 1173 }
1174 } 1174 }
1175 1175
1176 typedef void DefineMemberFunction(String invocationName, CodeBuffer definition); 1176 typedef void DefineMemberFunction(String invocationName, CodeBuffer definition);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698