| 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.new_js_emitter.model_emitter; | 5 library dart2js.new_js_emitter.model_emitter; |
| 6 | 6 |
| 7 import '../../dart2jslib.dart' show Compiler; | 7 import '../../dart2jslib.dart' show Compiler; |
| 8 import '../../js/js.dart' as js; | 8 import '../../js/js.dart' as js; |
| 9 import '../../js_backend/js_backend.dart' show | 9 import '../../js_backend/js_backend.dart' show |
| 10 JavaScriptBackend, | 10 JavaScriptBackend, |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 List<js.Statement> instantiations = | 289 List<js.Statement> instantiations = |
| 290 libraries.expand((Library library) => library.classes) | 290 libraries.expand((Library library) => library.classes) |
| 291 .where((Class cls) => cls.isEager) | 291 .where((Class cls) => cls.isEager) |
| 292 .map(createInstantiation) | 292 .map(createInstantiation) |
| 293 .toList(growable: false); | 293 .toList(growable: false); |
| 294 return new js.Block(instantiations); | 294 return new js.Block(instantiations); |
| 295 } | 295 } |
| 296 | 296 |
| 297 js.Expression emitLibrary(Library library) { | 297 js.Expression emitLibrary(Library library) { |
| 298 Iterable staticDescriptors = library.statics.expand((e) => | 298 Iterable staticDescriptors = library.statics.expand((StaticMethod e) => |
| 299 [ js.string(e.name), js.number(e.holder.index), emitStaticMethod(e) ]); | 299 [ js.string(e.name), js.number(e.holder.index), emitStaticMethod(e) ]); |
| 300 Iterable classDescriptors = library.classes.expand((e) => | 300 Iterable classDescriptors = library.classes.expand((Class e) => |
| 301 [ js.string(e.name), js.number(e.holder.index), emitClass(e) ]); | 301 [ js.string(e.name), js.number(e.holder.index), emitClass(e) ]); |
| 302 | 302 |
| 303 js.Expression staticArray = | 303 js.Expression staticArray = |
| 304 new js.ArrayInitializer(staticDescriptors.toList(growable: false)); | 304 new js.ArrayInitializer(staticDescriptors.toList(growable: false)); |
| 305 js.Expression classArray = | 305 js.Expression classArray = |
| 306 new js.ArrayInitializer(classDescriptors.toList(growable: false)); | 306 new js.ArrayInitializer(classDescriptors.toList(growable: false)); |
| 307 | 307 |
| 308 return new js.ArrayInitializer([staticArray, classArray]); | 308 return new js.ArrayInitializer([staticArray, classArray]); |
| 309 } | 309 } |
| 310 | 310 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 | 591 |
| 592 var end = Date.now(); | 592 var end = Date.now(); |
| 593 print('Setup: ' + (end - start) + ' ms.'); | 593 print('Setup: ' + (end - start) + ' ms.'); |
| 594 | 594 |
| 595 #main(); // Start main. | 595 #main(); // Start main. |
| 596 | 596 |
| 597 }(Date.now(), #code) | 597 }(Date.now(), #code) |
| 598 }"""; | 598 }"""; |
| 599 | 599 |
| 600 } | 600 } |
| OLD | NEW |