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.lazy_emitter.model_emitter; | 5 library dart2js.js_emitter.lazy_emitter.model_emitter; |
6 | 6 |
7 import '../../compiler.dart' show | 7 import '../../compiler.dart' show |
8 Compiler; | 8 Compiler; |
9 import '../../constants/values.dart' show | 9 import '../../constants/values.dart' show |
10 ConstantValue, | 10 ConstantValue, |
11 FunctionConstantValue; | 11 FunctionConstantValue; |
| 12 import '../../core_types.dart' show |
| 13 CoreClasses; |
12 import '../../elements/elements.dart' show | 14 import '../../elements/elements.dart' show |
13 ClassElement, | 15 ClassElement, |
14 FunctionElement; | 16 FunctionElement; |
15 import '../../js/js.dart' as js; | 17 import '../../js/js.dart' as js; |
16 import '../../js_backend/js_backend.dart' show | 18 import '../../js_backend/js_backend.dart' show |
17 JavaScriptBackend, | 19 JavaScriptBackend, |
18 Namer, | 20 Namer, |
19 ConstantEmitter; | 21 ConstantEmitter; |
20 | 22 |
21 import '../js_emitter.dart' show NativeEmitter; | 23 import '../js_emitter.dart' show NativeEmitter; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 new js.VariableDeclarationList( | 341 new js.VariableDeclarationList( |
340 [new js.VariableInitialization( | 342 [new js.VariableInitialization( |
341 new js.VariableDeclaration("init", allowRename: false), | 343 new js.VariableDeclaration("init", allowRename: false), |
342 globalsObject)]))]; | 344 globalsObject)]))]; |
343 return new js.Block(statements); | 345 return new js.Block(statements); |
344 } | 346 } |
345 | 347 |
346 js.Property emitMangledGlobalNames() { | 348 js.Property emitMangledGlobalNames() { |
347 List<js.Property> names = <js.Property>[]; | 349 List<js.Property> names = <js.Property>[]; |
348 | 350 |
| 351 CoreClasses coreClasses = compiler.coreClasses; |
349 // We want to keep the original names for the most common core classes when | 352 // We want to keep the original names for the most common core classes when |
350 // calling toString on them. | 353 // calling toString on them. |
351 List<ClassElement> nativeClassesNeedingUnmangledName = | 354 List<ClassElement> nativeClassesNeedingUnmangledName = |
352 [compiler.intClass, compiler.doubleClass, compiler.numClass, | 355 [coreClasses.intClass, coreClasses.doubleClass, coreClasses.numClass, |
353 compiler.stringClass, compiler.boolClass, compiler.nullClass, | 356 coreClasses.stringClass, coreClasses.boolClass, coreClasses.nullClass, |
354 compiler.listClass]; | 357 coreClasses.listClass]; |
355 nativeClassesNeedingUnmangledName.forEach((element) { | 358 nativeClassesNeedingUnmangledName.forEach((element) { |
356 names.add(new js.Property(js.quoteName(namer.className(element)), | 359 names.add(new js.Property(js.quoteName(namer.className(element)), |
357 js.string(element.name))); | 360 js.string(element.name))); |
358 }); | 361 }); |
359 | 362 |
360 return new js.Property(js.string(MANGLED_GLOBAL_NAMES), | 363 return new js.Property(js.string(MANGLED_GLOBAL_NAMES), |
361 new js.ObjectInitializer(names)); | 364 new js.ObjectInitializer(names)); |
362 } | 365 } |
363 | 366 |
364 js.Statement emitDeferredInitializerGlobal(Map loadMap) { | 367 js.Statement emitDeferredInitializerGlobal(Map loadMap) { |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 | 1248 |
1246 var end = Date.now(); | 1249 var end = Date.now(); |
1247 // print('Setup: ' + (end - start) + ' ms.'); | 1250 // print('Setup: ' + (end - start) + ' ms.'); |
1248 | 1251 |
1249 #invokeMain; // Start main. | 1252 #invokeMain; // Start main. |
1250 | 1253 |
1251 })(Date.now(), #code) | 1254 })(Date.now(), #code) |
1252 }"""; | 1255 }"""; |
1253 | 1256 |
1254 } | 1257 } |
OLD | NEW |