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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 850343005: Revert r42934. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 7
8 class OldEmitter implements Emitter { 8 class OldEmitter implements Emitter {
9 final Compiler compiler; 9 final Compiler compiler;
10 final CodeEmitterTask task; 10 final CodeEmitterTask task;
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 function dart_precompiled(\$collectedClasses) { 725 function dart_precompiled(\$collectedClasses) {
726 var \$desc; 726 var \$desc;
727 #; 727 #;
728 return #; 728 return #;
729 }''', 729 }''',
730 [cspPrecompiledFunctionFor(outputUnit), 730 [cspPrecompiledFunctionFor(outputUnit),
731 new jsAst.ArrayInitializer( 731 new jsAst.ArrayInitializer(
732 cspPrecompiledConstructorNamesFor(outputUnit))]); 732 cspPrecompiledConstructorNamesFor(outputUnit))]);
733 } 733 }
734 734
735 void emitClass(Class cls, ClassBuilder enclosingBuilder) { 735 void generateClass(ClassElement classElement, ClassBuilder properties) {
736 ClassElement classElement = cls.element;
737 compiler.withCurrentElement(classElement, () { 736 compiler.withCurrentElement(classElement, () {
738 if (compiler.hasIncrementalSupport) { 737 if (compiler.hasIncrementalSupport) {
739 ClassBuilder cachedBuilder = 738 ClassBuilder builder =
740 cachedClassBuilders.putIfAbsent(classElement, () { 739 cachedClassBuilders.putIfAbsent(classElement, () {
741 ClassBuilder builder = new ClassBuilder(classElement, namer); 740 ClassBuilder builder = new ClassBuilder(classElement, namer);
742 classEmitter.emitClass( 741 classEmitter.generateClass(
743 cls, builder, additionalProperties[classElement]); 742 classElement, builder, additionalProperties[classElement]);
744 return builder; 743 return builder;
745 }); 744 });
746 invariant(classElement, cachedBuilder.fields.isEmpty); 745 invariant(classElement, builder.fields.isEmpty);
747 invariant(classElement, cachedBuilder.superName == null); 746 invariant(classElement, builder.superName == null);
748 invariant(classElement, cachedBuilder.functionType == null); 747 invariant(classElement, builder.functionType == null);
749 invariant(classElement, cachedBuilder.fieldMetadata == null); 748 invariant(classElement, builder.fieldMetadata == null);
750 enclosingBuilder.properties.addAll(cachedBuilder.properties); 749 properties.properties.addAll(builder.properties);
751 } else { 750 } else {
752 classEmitter.emitClass( 751 classEmitter.generateClass(
753 cls, enclosingBuilder, additionalProperties[classElement]); 752 classElement, properties, additionalProperties[classElement]);
754 } 753 }
755 }); 754 });
756 } 755 }
757 756
758 void emitStaticFunctions(Iterable<Method> staticFunctions) { 757 void emitStaticFunctions(Iterable<Method> staticFunctions) {
759 if (staticFunctions == null) return; 758 if (staticFunctions == null) return;
760 // We need to filter out null-elements for the interceptors. 759 // We need to filter out null-elements for the interceptors.
761 Iterable<Element> elements = staticFunctions 760 Iterable<Element> elements = staticFunctions
762 .where((Method method) => method.element != null) 761 .where((Method method) => method.element != null)
763 .map((Method method) => method.element); 762 .map((Method method) => method.element);
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 element, MessageKind.GENERIC, {'text': 'Pending statics.'})); 1356 element, MessageKind.GENERIC, {'text': 'Pending statics.'}));
1358 } 1357 }
1359 1358
1360 if (pendingStatics != null && !pendingStatics.isEmpty) { 1359 if (pendingStatics != null && !pendingStatics.isEmpty) {
1361 compiler.internalError(pendingStatics.first, 1360 compiler.internalError(pendingStatics.first,
1362 'Pending statics (see above).'); 1361 'Pending statics (see above).');
1363 } 1362 }
1364 } 1363 }
1365 1364
1366 void emitLibrary(Library library) { 1365 void emitLibrary(Library library) {
1367 LibraryElement libraryElement = library.element;
1368
1369 emitStaticFunctions(library.statics); 1366 emitStaticFunctions(library.statics);
1370 1367
1371 ClassBuilder libraryBuilder = getElementDescriptor(libraryElement); 1368 Iterable<ClassElement> classes =
1372 for (Class cls in library.classes) { 1369 library.classes.map((Class cls) => cls.element);
1373 emitClass(cls, libraryBuilder); 1370 for (ClassElement element in classes) {
1371 generateClass(element, getElementDescriptor(element));
1374 } 1372 }
1375 1373
1376 classEmitter.emitFields(libraryElement, libraryBuilder, emitStatics: true); 1374 LibraryElement libraryElement = library.element;
1375 ClassBuilder builder = getElementDescriptor(libraryElement);
1376 classEmitter.emitFields(library.element, builder, emitStatics: true);
1377 } 1377 }
1378 1378
1379 void emitMainOutputUnit(Program program, 1379 void emitMainOutputUnit(Program program,
1380 Map<OutputUnit, String> deferredLoadHashes, 1380 Map<OutputUnit, String> deferredLoadHashes,
1381 CodeBuffer nativeBuffer) { 1381 CodeBuffer nativeBuffer) {
1382 Fragment mainFragment = program.fragments.first; 1382 Fragment mainFragment = program.fragments.first;
1383 OutputUnit mainOutputUnit = mainFragment.outputUnit; 1383 OutputUnit mainOutputUnit = mainFragment.outputUnit;
1384 1384
1385 LineColumnCollector lineColumnCollector; 1385 LineColumnCollector lineColumnCollector;
1386 List<CodeOutputListener> codeOutputListeners; 1386 List<CodeOutputListener> codeOutputListeners;
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2089 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2090 if (element.isInstanceMember) { 2090 if (element.isInstanceMember) {
2091 cachedClassBuilders.remove(element.enclosingClass); 2091 cachedClassBuilders.remove(element.enclosingClass);
2092 2092
2093 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2093 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2094 2094
2095 } 2095 }
2096 } 2096 }
2097 } 2097 }
2098 } 2098 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698