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:collection' show HashMap; | 7 import 'dart:collection' show HashMap; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
11 import 'package:js_runtime/shared/embedded_names.dart' | 11 import 'package:js_runtime/shared/embedded_names.dart' |
12 show JsBuiltin, JsGetName; | 12 show JsBuiltin, JsGetName; |
13 | 13 |
14 import '../../../compiler_new.dart'; | 14 import '../../../compiler_new.dart'; |
15 import '../../common.dart'; | 15 import '../../common.dart'; |
16 import '../../compiler.dart' show Compiler; | 16 import '../../compiler.dart' show Compiler; |
17 import '../../constants/values.dart'; | 17 import '../../constants/values.dart'; |
18 import '../../common_elements.dart' show CommonElements, ElementEnvironment; | 18 import '../../common_elements.dart' show CommonElements, ElementEnvironment; |
19 import '../../elements/resolution_types.dart' show ResolutionDartType; | 19 import '../../elements/resolution_types.dart' show ResolutionDartType; |
20 import '../../deferred_load.dart' show OutputUnit; | 20 import '../../deferred_load.dart' show OutputUnit; |
21 import '../../elements/elements.dart' | 21 import '../../elements/elements.dart' |
22 show | 22 show ConstructorBodyElement, FieldElement, LibraryElement, TypedefElement; |
23 ClassElement, | |
24 ConstructorBodyElement, | |
25 FieldElement, | |
26 LibraryElement, | |
27 TypedefElement; | |
28 import '../../elements/entities.dart'; | 23 import '../../elements/entities.dart'; |
29 import '../../elements/entity_utils.dart' as utils; | 24 import '../../elements/entity_utils.dart' as utils; |
30 import '../../elements/names.dart'; | 25 import '../../elements/names.dart'; |
31 import '../../hash/sha1.dart' show Hasher; | 26 import '../../hash/sha1.dart' show Hasher; |
32 import '../../io/code_output.dart'; | 27 import '../../io/code_output.dart'; |
33 import '../../io/location_provider.dart' show LocationCollector; | 28 import '../../io/location_provider.dart' show LocationCollector; |
34 import '../../io/source_map_builder.dart' show SourceMapBuilder; | 29 import '../../io/source_map_builder.dart' show SourceMapBuilder; |
35 import '../../js/js.dart' as jsAst; | 30 import '../../js/js.dart' as jsAst; |
36 import '../../js/js.dart' show js; | 31 import '../../js/js.dart' show js; |
37 import '../../js_backend/js_backend.dart' | 32 import '../../js_backend/js_backend.dart' |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 @override | 308 @override |
314 jsAst.Expression isolateStaticClosureAccess(FunctionEntity element) { | 309 jsAst.Expression isolateStaticClosureAccess(FunctionEntity element) { |
315 return jsAst.js('#.#()', [ | 310 return jsAst.js('#.#()', [ |
316 namer.globalObjectForMember(element), | 311 namer.globalObjectForMember(element), |
317 namer.staticClosureName(element) | 312 namer.staticClosureName(element) |
318 ]); | 313 ]); |
319 } | 314 } |
320 | 315 |
321 @override | 316 @override |
322 jsAst.PropertyAccess prototypeAccess( | 317 jsAst.PropertyAccess prototypeAccess( |
323 ClassElement element, bool hasBeenInstantiated) { | 318 ClassEntity element, bool hasBeenInstantiated) { |
324 return jsAst.js('#.prototype', constructorAccess(element)); | 319 return jsAst.js('#.prototype', constructorAccess(element)); |
325 } | 320 } |
326 | 321 |
327 @override | 322 @override |
328 jsAst.Template templateForBuiltin(JsBuiltin builtin) { | 323 jsAst.Template templateForBuiltin(JsBuiltin builtin) { |
329 switch (builtin) { | 324 switch (builtin) { |
330 case JsBuiltin.dartObjectConstructor: | 325 case JsBuiltin.dartObjectConstructor: |
331 return jsAst.js | 326 return jsAst.js |
332 .expressionTemplateYielding(typeAccess(commonElements.objectClass)); | 327 .expressionTemplateYielding(typeAccess(commonElements.objectClass)); |
333 | 328 |
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 // data. | 1967 // data. |
1973 mapping["_comment"] = "This mapping shows which compiled `.js` files are " | 1968 mapping["_comment"] = "This mapping shows which compiled `.js` files are " |
1974 "needed for a given deferred library import."; | 1969 "needed for a given deferred library import."; |
1975 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); | 1970 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); |
1976 compiler.outputProvider( | 1971 compiler.outputProvider( |
1977 compiler.options.deferredMapUri.path, '', OutputType.info) | 1972 compiler.options.deferredMapUri.path, '', OutputType.info) |
1978 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) | 1973 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) |
1979 ..close(); | 1974 ..close(); |
1980 } | 1975 } |
1981 } | 1976 } |
OLD | NEW |