| 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; | 18 import '../../common_elements.dart' show CommonElements; |
| 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 |
| 23 ClassElement, | 23 ClassElement, |
| 24 Element, | 24 Element, |
| 25 Elements, | |
| 26 FieldElement, | 25 FieldElement, |
| 27 FunctionSignature, | 26 FunctionSignature, |
| 28 LibraryElement, | 27 LibraryElement, |
| 29 MethodElement, | 28 MethodElement, |
| 30 TypedefElement; | 29 TypedefElement; |
| 31 import '../../elements/entities.dart'; | 30 import '../../elements/entities.dart'; |
| 31 import '../../elements/entity_utils.dart' as utils; |
| 32 import '../../hash/sha1.dart' show Hasher; | 32 import '../../hash/sha1.dart' show Hasher; |
| 33 import '../../io/code_output.dart'; | 33 import '../../io/code_output.dart'; |
| 34 import '../../io/location_provider.dart' show LocationCollector; | 34 import '../../io/location_provider.dart' show LocationCollector; |
| 35 import '../../io/source_map_builder.dart' show SourceMapBuilder; | 35 import '../../io/source_map_builder.dart' show SourceMapBuilder; |
| 36 import '../../js/js.dart' as jsAst; | 36 import '../../js/js.dart' as jsAst; |
| 37 import '../../js/js.dart' show js; | 37 import '../../js/js.dart' show js; |
| 38 import '../../js_backend/js_backend.dart' | 38 import '../../js_backend/js_backend.dart' |
| 39 show | 39 show |
| 40 ConstantEmitter, | 40 ConstantEmitter, |
| 41 JavaScriptBackend, | 41 JavaScriptBackend, |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 String namedArguments = ''; | 474 String namedArguments = ''; |
| 475 bool isConstructor = false; | 475 bool isConstructor = false; |
| 476 if (elementOrSelector is Selector) { | 476 if (elementOrSelector is Selector) { |
| 477 CallStructure callStructure = elementOrSelector.callStructure; | 477 CallStructure callStructure = elementOrSelector.callStructure; |
| 478 positionalParameterCount = callStructure.positionalArgumentCount; | 478 positionalParameterCount = callStructure.positionalArgumentCount; |
| 479 namedArguments = namedParametersAsReflectionNames(callStructure); | 479 namedArguments = namedParametersAsReflectionNames(callStructure); |
| 480 } else { | 480 } else { |
| 481 MethodElement function = elementOrSelector; | 481 MethodElement function = elementOrSelector; |
| 482 if (function.isConstructor) { | 482 if (function.isConstructor) { |
| 483 isConstructor = true; | 483 isConstructor = true; |
| 484 name = Elements.reconstructConstructorName(function); | 484 name = utils.reconstructConstructorName(function); |
| 485 } | 485 } |
| 486 FunctionSignature signature = function.functionSignature; | 486 FunctionSignature signature = function.functionSignature; |
| 487 positionalParameterCount = signature.requiredParameterCount; | 487 positionalParameterCount = signature.requiredParameterCount; |
| 488 if (signature.optionalParametersAreNamed) { | 488 if (signature.optionalParametersAreNamed) { |
| 489 var names = []; | 489 var names = []; |
| 490 for (Element e in signature.optionalParameters) { | 490 for (Element e in signature.optionalParameters) { |
| 491 names.add(e.name); | 491 names.add(e.name); |
| 492 } | 492 } |
| 493 CallStructure callStructure = | 493 CallStructure callStructure = |
| 494 new CallStructure(positionalParameterCount, names); | 494 new CallStructure(positionalParameterCount, names); |
| (...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 // data. | 1921 // data. |
| 1922 mapping["_comment"] = "This mapping shows which compiled `.js` files are " | 1922 mapping["_comment"] = "This mapping shows which compiled `.js` files are " |
| 1923 "needed for a given deferred library import."; | 1923 "needed for a given deferred library import."; |
| 1924 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); | 1924 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); |
| 1925 compiler.outputProvider( | 1925 compiler.outputProvider( |
| 1926 compiler.options.deferredMapUri.path, '', OutputType.info) | 1926 compiler.options.deferredMapUri.path, '', OutputType.info) |
| 1927 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) | 1927 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) |
| 1928 ..close(); | 1928 ..close(); |
| 1929 } | 1929 } |
| 1930 } | 1930 } |
| OLD | NEW |