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

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: Add parsing and testing of array holes, make lists non-growable 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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 } 1835 }
1836 1836
1837 deferredLibraryUris[loadId] = uris; 1837 deferredLibraryUris[loadId] = uris;
1838 deferredLibraryHashes[loadId] = hashes; 1838 deferredLibraryHashes[loadId] = hashes;
1839 }); 1839 });
1840 1840
1841 void emitMapping(String name, Map<String, List<String>> mapping) { 1841 void emitMapping(String name, Map<String, List<String>> mapping) {
1842 List<jsAst.Property> properties = new List<jsAst.Property>(); 1842 List<jsAst.Property> properties = new List<jsAst.Property>();
1843 mapping.forEach((String key, List<String> values) { 1843 mapping.forEach((String key, List<String> values) {
1844 properties.add(new jsAst.Property(js.escapedString(key), 1844 properties.add(new jsAst.Property(js.escapedString(key),
1845 new jsAst.ArrayInitializer.from( 1845 new jsAst.ArrayInitializer(
1846 values.map(js.escapedString)))); 1846 values.map(js.escapedString).toList())));
1847 }); 1847 });
1848 jsAst.Node initializer = 1848 jsAst.Node initializer =
1849 new jsAst.ObjectInitializer(properties, isOneLiner: true); 1849 new jsAst.ObjectInitializer(properties, isOneLiner: true);
1850 1850
1851 jsAst.Node globalName = generateEmbeddedGlobalAccess(name); 1851 jsAst.Node globalName = generateEmbeddedGlobalAccess(name);
1852 buffer.write(jsAst.prettyPrint( 1852 buffer.write(jsAst.prettyPrint(
1853 js("# = #", [globalName, initializer]), 1853 js("# = #", [globalName, initializer]),
1854 compiler, monitor: compiler.dumpInfoTask)); 1854 compiler, monitor: compiler.dumpInfoTask));
1855 buffer.write('$N'); 1855 buffer.write('$N');
1856 1856
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2013 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2014 if (element.isInstanceMember) { 2014 if (element.isInstanceMember) {
2015 cachedClassBuilders.remove(element.enclosingClass); 2015 cachedClassBuilders.remove(element.enclosingClass);
2016 2016
2017 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2017 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2018 2018
2019 } 2019 }
2020 } 2020 }
2021 } 2021 }
2022 } 2022 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698