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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 jsAst.Name constructorName, | 1019 jsAst.Name constructorName, |
1020 jsAst.Expression constructorAst, | 1020 jsAst.Expression constructorAst, |
1021 List<jsAst.Name> fields) { | 1021 List<jsAst.Name> fields) { |
1022 cspPrecompiledFunctionFor(outputUnit).add( | 1022 cspPrecompiledFunctionFor(outputUnit).add( |
1023 new jsAst.FunctionDeclaration(constructorName, constructorAst)); | 1023 new jsAst.FunctionDeclaration(constructorName, constructorAst)); |
1024 | 1024 |
1025 String fieldNamesProperty = FIELD_NAMES_PROPERTY_NAME; | 1025 String fieldNamesProperty = FIELD_NAMES_PROPERTY_NAME; |
1026 bool hasIsolateSupport = compiler.hasIsolateSupport; | 1026 bool hasIsolateSupport = compiler.hasIsolateSupport; |
1027 jsAst.Node fieldNamesArray; | 1027 jsAst.Node fieldNamesArray; |
1028 if (hasIsolateSupport) { | 1028 if (hasIsolateSupport) { |
1029 fieldNamesArray = js.concatenateStrings( | 1029 fieldNamesArray = |
1030 js.joinLiterals(fields, js.stringPart(",")), | 1030 new jsAst.ArrayInitializer(fields.map(js.quoteName).toList()); |
1031 addQuotes: true); | |
1032 } else { | 1031 } else { |
1033 fieldNamesArray = new jsAst.LiteralNull(); | 1032 fieldNamesArray = new jsAst.LiteralNull(); |
1034 } | 1033 } |
1035 | 1034 |
1036 cspPrecompiledFunctionFor(outputUnit).add(js.statement(r''' | 1035 cspPrecompiledFunctionFor(outputUnit).add(js.statement(r''' |
1037 { | 1036 { |
1038 #constructorName.#typeNameProperty = #constructorNameString; | 1037 #constructorName.#typeNameProperty = #constructorNameString; |
1039 // IE does not have a name property. | 1038 // IE does not have a name property. |
1040 if (!("name" in #constructorName)) | 1039 if (!("name" in #constructorName)) |
1041 #constructorName.name = #constructorNameString; | 1040 #constructorName.name = #constructorNameString; |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2006 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
2008 if (element.isInstanceMember) { | 2007 if (element.isInstanceMember) { |
2009 cachedClassBuilders.remove(element.enclosingClass); | 2008 cachedClassBuilders.remove(element.enclosingClass); |
2010 | 2009 |
2011 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2010 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
2012 | 2011 |
2013 } | 2012 } |
2014 } | 2013 } |
2015 } | 2014 } |
2016 } | 2015 } |
OLD | NEW |