| 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.program_builder; | 5 library dart2js.js_emitter.program_builder; |
| 6 | 6 |
| 7 import 'model.dart'; | 7 import 'model.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../js/js.dart' as js; | 9 import '../js/js.dart' as js; |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 /// Mapping from [OutputUnit] to constructed [Output]. We need this to | 41 /// Mapping from [OutputUnit] to constructed [Output]. We need this to |
| 42 /// generate the deferredLoadingMap (to know which hunks to load). | 42 /// generate the deferredLoadingMap (to know which hunks to load). |
| 43 final Map<OutputUnit, Output> _outputs = <OutputUnit, Output>{}; | 43 final Map<OutputUnit, Output> _outputs = <OutputUnit, Output>{}; |
| 44 | 44 |
| 45 Program buildProgram() { | 45 Program buildProgram() { |
| 46 Set<ClassElement> neededClasses = _task.neededClasses; | 46 Set<ClassElement> neededClasses = _task.neededClasses; |
| 47 Iterable<Element> neededStatics = backend.generatedCode.keys | 47 Iterable<Element> neededStatics = backend.generatedCode.keys |
| 48 .where((Element e) => !e.isInstanceMember && !e.isField); | 48 .where((Element e) => !e.isInstanceMember && !e.isField); |
| 49 | 49 |
| 50 Elements.sortedByPosition(neededClasses).forEach(_registry.registerElement); | 50 _task.outputClassLists.forEach(_registry.registerElements); |
| 51 Elements.sortedByPosition(neededStatics).forEach(_registry.registerElement); | 51 _task.outputStaticLists.forEach(_registry.registerElements); |
| 52 | 52 |
| 53 // TODO(kasperl): There's code that implicitly needs access to the special | 53 // TODO(kasperl): There's code that implicitly needs access to the special |
| 54 // $ holder so we have to register that. Can we track if we have to? | 54 // $ holder so we have to register that. Can we track if we have to? |
| 55 _registry.registerHolder(r'$'); | 55 _registry.registerHolder(r'$'); |
| 56 | 56 |
| 57 MainOutput mainOutput = _buildMainOutput(_registry.mainFragment); | 57 MainOutput mainOutput = _buildMainOutput(_registry.mainFragment); |
| 58 Iterable<Output> deferredOutputs = _registry.deferredFragments | 58 Iterable<Output> deferredOutputs = _registry.deferredFragments |
| 59 .map((fragment) => _buildDeferredOutput(mainOutput, fragment)); | 59 .map((fragment) => _buildDeferredOutput(mainOutput, fragment)); |
| 60 | 60 |
| 61 List<Output> outputs = new List<Output>(_registry.fragmentCount); | 61 List<Output> outputs = new List<Output>(_registry.fragmentCount); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 | 183 |
| 184 StaticMethod _buildStaticMethodTearOff(FunctionElement element) { | 184 StaticMethod _buildStaticMethodTearOff(FunctionElement element) { |
| 185 String name = namer.getStaticClosureName(element); | 185 String name = namer.getStaticClosureName(element); |
| 186 String holder = namer.globalObjectFor(element); | 186 String holder = namer.globalObjectFor(element); |
| 187 // TODO(kasperl): This clearly doesn't work yet. | 187 // TODO(kasperl): This clearly doesn't work yet. |
| 188 js.Expression code = js.string("<<unimplemented>>"); | 188 js.Expression code = js.string("<<unimplemented>>"); |
| 189 return new StaticMethod(name, _registry.registerHolder(holder), code); | 189 return new StaticMethod(name, _registry.registerHolder(holder), code); |
| 190 } | 190 } |
| 191 } | 191 } |
| OLD | NEW |