| 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 library dart2js.js_emitter.full_emitter; | 5 library dart2js.js_emitter.full_emitter; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 import 'dart:collection' show HashMap; | 8 import 'dart:collection' show HashMap; |
| 9 | 9 |
| 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 GetterName, | 67 GetterName, |
| 68 JavaScriptBackend, | 68 JavaScriptBackend, |
| 69 JavaScriptConstantCompiler, | 69 JavaScriptConstantCompiler, |
| 70 Namer, | 70 Namer, |
| 71 RuntimeTypes, | 71 RuntimeTypes, |
| 72 SetterName, | 72 SetterName, |
| 73 Substitution, | 73 Substitution, |
| 74 TypeCheck, | 74 TypeCheck, |
| 75 TypeChecks, | 75 TypeChecks, |
| 76 TypeVariableHandler; | 76 TypeVariableHandler; |
| 77 import '../../js/js_debug.dart'; |
| 77 import '../../universe/call_structure.dart' show | 78 import '../../universe/call_structure.dart' show |
| 78 CallStructure; | 79 CallStructure; |
| 79 import '../../universe/selector.dart' show | 80 import '../../universe/selector.dart' show |
| 80 Selector; | 81 Selector; |
| 81 import '../../util/characters.dart' show | 82 import '../../util/characters.dart' show |
| 82 $$, | 83 $$, |
| 83 $A, | 84 $A, |
| 84 $HASH, | 85 $HASH, |
| 85 $PERIOD, | 86 $PERIOD, |
| 86 $Z, | 87 $Z, |
| (...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 lineColumnCollector = new LineColumnCollector(); | 1603 lineColumnCollector = new LineColumnCollector(); |
| 1603 codeOutputListeners = <CodeOutputListener>[lineColumnCollector]; | 1604 codeOutputListeners = <CodeOutputListener>[lineColumnCollector]; |
| 1604 } | 1605 } |
| 1605 | 1606 |
| 1606 CodeOutput mainOutput = | 1607 CodeOutput mainOutput = |
| 1607 new StreamCodeOutput(compiler.outputProvider('', 'js'), | 1608 new StreamCodeOutput(compiler.outputProvider('', 'js'), |
| 1608 codeOutputListeners); | 1609 codeOutputListeners); |
| 1609 outputBuffers[mainOutputUnit] = mainOutput; | 1610 outputBuffers[mainOutputUnit] = mainOutput; |
| 1610 | 1611 |
| 1611 | 1612 |
| 1612 mainOutput.addBuffer(jsAst.prettyPrint(program, | 1613 mainOutput.addBuffer(jsAst.createCodeBuffer( |
| 1613 compiler, | 1614 program, compiler, monitor: compiler.dumpInfoTask)); |
| 1614 monitor: compiler.dumpInfoTask)); | |
| 1615 | 1615 |
| 1616 if (compiler.deferredMapUri != null) { | 1616 if (compiler.deferredMapUri != null) { |
| 1617 outputDeferredMap(); | 1617 outputDeferredMap(); |
| 1618 } | 1618 } |
| 1619 | 1619 |
| 1620 if (generateSourceMap) { | 1620 if (generateSourceMap) { |
| 1621 mainOutput.add( | 1621 mainOutput.add( |
| 1622 generateSourceMapTag(compiler.sourceMapUri, compiler.outputUri)); | 1622 generateSourceMapTag(compiler.sourceMapUri, compiler.outputUri)); |
| 1623 } | 1623 } |
| 1624 | 1624 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 } | 2048 } |
| 2049 | 2049 |
| 2050 String partPrefix = | 2050 String partPrefix = |
| 2051 backend.deferredPartFileName(outputUnit.name, addExtension: false); | 2051 backend.deferredPartFileName(outputUnit.name, addExtension: false); |
| 2052 CodeOutput output = new StreamCodeOutput( | 2052 CodeOutput output = new StreamCodeOutput( |
| 2053 compiler.outputProvider(partPrefix, 'part.js'), | 2053 compiler.outputProvider(partPrefix, 'part.js'), |
| 2054 outputListeners); | 2054 outputListeners); |
| 2055 | 2055 |
| 2056 outputBuffers[outputUnit] = output; | 2056 outputBuffers[outputUnit] = output; |
| 2057 | 2057 |
| 2058 output.addBuffer(jsAst.prettyPrint(outputAsts[outputUnit], | 2058 output.addBuffer(jsAst.createCodeBuffer( |
| 2059 compiler, | 2059 outputAsts[outputUnit], compiler, monitor: compiler.dumpInfoTask)); |
| 2060 monitor: compiler.dumpInfoTask)); | |
| 2061 | 2060 |
| 2062 // Make a unique hash of the code (before the sourcemaps are added) | 2061 // Make a unique hash of the code (before the sourcemaps are added) |
| 2063 // This will be used to retrieve the initializing function from the global | 2062 // This will be used to retrieve the initializing function from the global |
| 2064 // variable. | 2063 // variable. |
| 2065 String hash = hasher.getHash(); | 2064 String hash = hasher.getHash(); |
| 2066 | 2065 |
| 2067 output.add('$N${deferredInitializers}["$hash"]$_=$_' | 2066 output.add('$N${deferredInitializers}["$hash"]$_=$_' |
| 2068 '${deferredInitializers}.current$N'); | 2067 '${deferredInitializers}.current$N'); |
| 2069 | 2068 |
| 2070 if (generateSourceMap) { | 2069 if (generateSourceMap) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2142 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 2144 if (element.isInstanceMember) { | 2143 if (element.isInstanceMember) { |
| 2145 cachedClassBuilders.remove(element.enclosingClass); | 2144 cachedClassBuilders.remove(element.enclosingClass); |
| 2146 | 2145 |
| 2147 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2146 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2148 | 2147 |
| 2149 } | 2148 } |
| 2150 } | 2149 } |
| 2151 } | 2150 } |
| 2152 } | 2151 } |
| OLD | NEW |