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

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

Issue 750323003: Remove js.ArrayElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 6 years 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) 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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 jsAst.FunctionDeclaration buildCspPrecompiledFunctionFor( 850 jsAst.FunctionDeclaration buildCspPrecompiledFunctionFor(
851 OutputUnit outputUnit) { 851 OutputUnit outputUnit) {
852 // TODO(ahe): Compute a hash code. 852 // TODO(ahe): Compute a hash code.
853 return js.statement(''' 853 return js.statement('''
854 function dart_precompiled(\$collectedClasses) { 854 function dart_precompiled(\$collectedClasses) {
855 var \$desc; 855 var \$desc;
856 #; 856 #;
857 return #; 857 return #;
858 }''', 858 }''',
859 [cspPrecompiledFunctionFor(outputUnit), 859 [cspPrecompiledFunctionFor(outputUnit),
860 new jsAst.ArrayInitializer.from( 860 new jsAst.ArrayInitializer(
861 cspPrecompiledConstructorNamesFor(outputUnit))]); 861 cspPrecompiledConstructorNamesFor(outputUnit))]);
862 } 862 }
863 863
864 void generateClass(ClassElement classElement, ClassBuilder properties) { 864 void generateClass(ClassElement classElement, ClassBuilder properties) {
865 compiler.withCurrentElement(classElement, () { 865 compiler.withCurrentElement(classElement, () {
866 if (compiler.hasIncrementalSupport) { 866 if (compiler.hasIncrementalSupport) {
867 ClassBuilder builder = 867 ClassBuilder builder =
868 cachedClassBuilders.putIfAbsent(classElement, () { 868 cachedClassBuilders.putIfAbsent(classElement, () {
869 ClassBuilder builder = new ClassBuilder(classElement, namer); 869 ClassBuilder builder = new ClassBuilder(classElement, namer);
870 classEmitter.generateClass( 870 classEmitter.generateClass(
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 } 1890 }
1891 1891
1892 deferredLibraryUris[loadId] = uris; 1892 deferredLibraryUris[loadId] = uris;
1893 deferredLibraryHashes[loadId] = hashes; 1893 deferredLibraryHashes[loadId] = hashes;
1894 }); 1894 });
1895 1895
1896 void emitMapping(String name, Map<String, List<String>> mapping) { 1896 void emitMapping(String name, Map<String, List<String>> mapping) {
1897 List<jsAst.Property> properties = new List<jsAst.Property>(); 1897 List<jsAst.Property> properties = new List<jsAst.Property>();
1898 mapping.forEach((String key, List<String> values) { 1898 mapping.forEach((String key, List<String> values) {
1899 properties.add(new jsAst.Property(js.escapedString(key), 1899 properties.add(new jsAst.Property(js.escapedString(key),
1900 new jsAst.ArrayInitializer.from( 1900 new jsAst.ArrayInitializer(
1901 values.map(js.escapedString)))); 1901 values.map(js.escapedString).toList())));
1902 }); 1902 });
1903 jsAst.Node initializer = 1903 jsAst.Node initializer =
1904 new jsAst.ObjectInitializer(properties, isOneLiner: true); 1904 new jsAst.ObjectInitializer(properties, isOneLiner: true);
1905 1905
1906 jsAst.Node globalName = generateEmbeddedGlobalAccess(name); 1906 jsAst.Node globalName = generateEmbeddedGlobalAccess(name);
1907 buffer.write(jsAst.prettyPrint( 1907 buffer.write(jsAst.prettyPrint(
1908 js("# = #", [globalName, initializer]), 1908 js("# = #", [globalName, initializer]),
1909 compiler, monitor: compiler.dumpInfoTask)); 1909 compiler, monitor: compiler.dumpInfoTask));
1910 buffer.write('$N'); 1910 buffer.write('$N');
1911 1911
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2068 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2069 if (element.isInstanceMember) { 2069 if (element.isInstanceMember) {
2070 cachedClassBuilders.remove(element.enclosingClass); 2070 cachedClassBuilders.remove(element.enclosingClass);
2071 2071
2072 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2072 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2073 2073
2074 } 2074 }
2075 } 2075 }
2076 } 2076 }
2077 } 2077 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698