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' show LibraryElement, TypedefElement; |
22 show ConstructorBodyElement, LibraryElement, TypedefElement; | |
23 import '../../elements/entities.dart'; | 22 import '../../elements/entities.dart'; |
24 import '../../elements/entity_utils.dart' as utils; | 23 import '../../elements/entity_utils.dart' as utils; |
25 import '../../elements/names.dart'; | 24 import '../../elements/names.dart'; |
26 import '../../hash/sha1.dart' show Hasher; | 25 import '../../hash/sha1.dart' show Hasher; |
27 import '../../io/code_output.dart'; | 26 import '../../io/code_output.dart'; |
28 import '../../io/location_provider.dart' show LocationCollector; | 27 import '../../io/location_provider.dart' show LocationCollector; |
29 import '../../io/source_map_builder.dart' show SourceMapBuilder; | 28 import '../../io/source_map_builder.dart' show SourceMapBuilder; |
30 import '../../js/js.dart' as jsAst; | 29 import '../../js/js.dart' as jsAst; |
31 import '../../js/js.dart' show js; | 30 import '../../js/js.dart' show js; |
32 import '../../js_backend/js_backend.dart' | 31 import '../../js_backend/js_backend.dart' |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // an instance method and a global. They may have the same mangled name. | 457 // an instance method and a global. They may have the same mangled name. |
459 // if (recordedMangledNames.contains(mangledName)) return null; | 458 // if (recordedMangledNames.contains(mangledName)) return null; |
460 recordedMangledNames.add(mangledName); | 459 recordedMangledNames.add(mangledName); |
461 return getReflectionMemberNameInternal(member, mangledName); | 460 return getReflectionMemberNameInternal(member, mangledName); |
462 } | 461 } |
463 return null; | 462 return null; |
464 } | 463 } |
465 | 464 |
466 String getReflectionMemberNameInternal( | 465 String getReflectionMemberNameInternal( |
467 MemberEntity member, jsAst.Name mangledName) { | 466 MemberEntity member, jsAst.Name mangledName) { |
468 if (member is ConstructorBodyElement) { | 467 if (member is ConstructorBodyEntity) { |
469 return null; | 468 return null; |
470 } | 469 } |
471 if (member.isGetter) { | 470 if (member.isGetter) { |
472 return _getReflectionGetterName(member.memberName); | 471 return _getReflectionGetterName(member.memberName); |
473 } else if (member.isSetter) { | 472 } else if (member.isSetter) { |
474 return _getReflectionSetterName(member.memberName, mangledName); | 473 return _getReflectionSetterName(member.memberName, mangledName); |
475 } else if (member.isConstructor) { | 474 } else if (member.isConstructor) { |
476 ConstructorEntity constructor = member; | 475 ConstructorEntity constructor = member; |
477 String name = utils.reconstructConstructorName(constructor); | 476 String name = utils.reconstructConstructorName(constructor); |
478 return _getReflectionCallStructureName( | 477 return _getReflectionCallStructureName( |
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 // data. | 1963 // data. |
1965 mapping["_comment"] = "This mapping shows which compiled `.js` files are " | 1964 mapping["_comment"] = "This mapping shows which compiled `.js` files are " |
1966 "needed for a given deferred library import."; | 1965 "needed for a given deferred library import."; |
1967 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); | 1966 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); |
1968 compiler.outputProvider( | 1967 compiler.outputProvider( |
1969 compiler.options.deferredMapUri.path, '', OutputType.info) | 1968 compiler.options.deferredMapUri.path, '', OutputType.info) |
1970 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) | 1969 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) |
1971 ..close(); | 1970 ..close(); |
1972 } | 1971 } |
1973 } | 1972 } |
OLD | NEW |