OLD | NEW |
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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 if (compiler.hasIncrementalSupport && isMainFragment) { | 861 if (compiler.hasIncrementalSupport && isMainFragment) { |
862 constantOutput = cachedEmittedConstantsBuffer; | 862 constantOutput = cachedEmittedConstantsBuffer; |
863 } | 863 } |
864 for (Constant constant in constants) { | 864 for (Constant constant in constants) { |
865 ConstantValue constantValue = constant.value; | 865 ConstantValue constantValue = constant.value; |
866 if (compiler.hasIncrementalSupport && isMainFragment) { | 866 if (compiler.hasIncrementalSupport && isMainFragment) { |
867 if (cachedEmittedConstants.contains(constantValue)) continue; | 867 if (cachedEmittedConstants.contains(constantValue)) continue; |
868 cachedEmittedConstants.add(constantValue); | 868 cachedEmittedConstants.add(constantValue); |
869 } | 869 } |
870 jsAst.Expression init = buildConstantInitializer(constantValue); | 870 jsAst.Expression init = buildConstantInitializer(constantValue); |
871 constantOutput.addBuffer(jsAst.prettyPrint(init, compiler, | 871 constantOutput.addBuffer( |
872 monitor: compiler.dumpInfoTask)); | 872 jsAst.prettyPrint(init, compiler, monitor: compiler.dumpInfoTask)); |
873 constantOutput.add('$N'); | 873 constantOutput.add('$N'); |
874 } | 874 } |
875 if (compiler.hasIncrementalSupport && isMainFragment) { | 875 if (compiler.hasIncrementalSupport && isMainFragment) { |
876 output.addBuffer(constantOutput); | 876 output.addBuffer(constantOutput); |
877 } | 877 } |
878 } | 878 } |
879 | 879 |
880 jsAst.Expression buildConstantInitializer(ConstantValue constant) { | 880 jsAst.Expression buildConstantInitializer(ConstantValue constant) { |
881 String name = namer.constantName(constant); | 881 String name = namer.constantName(constant); |
882 return js('#.# = #', | 882 return js('#.# = #', |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 1997 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
1998 if (element.isInstanceMember) { | 1998 if (element.isInstanceMember) { |
1999 cachedClassBuilders.remove(element.enclosingClass); | 1999 cachedClassBuilders.remove(element.enclosingClass); |
2000 | 2000 |
2001 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2001 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
2002 | 2002 |
2003 } | 2003 } |
2004 } | 2004 } |
2005 } | 2005 } |
2006 } | 2006 } |
OLD | NEW |