Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart

Issue 2908153003: It's alive! (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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, 25 Elements,
26 FieldElement, 26 FieldElement,
27 FunctionElement,
28 FunctionSignature, 27 FunctionSignature,
29 LibraryElement, 28 LibraryElement,
30 MethodElement, 29 MethodElement,
31 TypedefElement; 30 TypedefElement;
32 import '../../elements/entities.dart'; 31 import '../../elements/entities.dart';
33 import '../../hash/sha1.dart' show Hasher; 32 import '../../hash/sha1.dart' show Hasher;
34 import '../../io/code_output.dart'; 33 import '../../io/code_output.dart';
35 import '../../io/location_provider.dart' show LocationCollector; 34 import '../../io/location_provider.dart' show LocationCollector;
36 import '../../io/source_map_builder.dart' show SourceMapBuilder; 35 import '../../io/source_map_builder.dart' show SourceMapBuilder;
37 import '../../js/js.dart' as jsAst; 36 import '../../js/js.dart' as jsAst;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 160
162 /** 161 /**
163 * Accumulate properties for classes and libraries, describing their 162 * Accumulate properties for classes and libraries, describing their
164 * static/top-level members. 163 * static/top-level members.
165 * Later, these members are emitted when the class or library is emitted. 164 * Later, these members are emitted when the class or library is emitted.
166 * 165 *
167 * See [getElementDescriptor]. 166 * See [getElementDescriptor].
168 */ 167 */
169 // TODO(ahe): Generate statics with their class, and store only libraries in 168 // TODO(ahe): Generate statics with their class, and store only libraries in
170 // this map. 169 // this map.
171 final Map<Fragment, Map<Element, ClassBuilder>> elementDescriptors = 170 final Map<Fragment, Map<LibraryEntity, ClassBuilder>> libraryDescriptors =
172 new Map<Fragment, Map<Element, ClassBuilder>>(); 171 new Map<Fragment, Map<LibraryEntity, ClassBuilder>>();
172
173 final Map<Fragment, Map<ClassEntity, ClassBuilder>> classDescriptors =
174 new Map<Fragment, Map<ClassEntity, ClassBuilder>>();
173 175
174 final bool generateSourceMap; 176 final bool generateSourceMap;
175 177
176 Emitter(this.compiler, this.namer, this._closedWorld, this.generateSourceMap, 178 Emitter(this.compiler, this.namer, this._closedWorld, this.generateSourceMap,
177 this.task, this._sorter) 179 this.task, this._sorter)
178 : classEmitter = new ClassEmitter(_closedWorld), 180 : classEmitter = new ClassEmitter(_closedWorld),
179 interceptorEmitter = new InterceptorEmitter(_closedWorld), 181 interceptorEmitter = new InterceptorEmitter(_closedWorld),
180 nsmEmitter = new NsmEmitter(_closedWorld) { 182 nsmEmitter = new NsmEmitter(_closedWorld) {
181 constantEmitter = new ConstantEmitter( 183 constantEmitter = new ConstantEmitter(
182 compiler.options, 184 compiler.options,
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 elementOrSelector.isFunction || 471 elementOrSelector.isFunction ||
470 elementOrSelector.isConstructor) { 472 elementOrSelector.isConstructor) {
471 int positionalParameterCount; 473 int positionalParameterCount;
472 String namedArguments = ''; 474 String namedArguments = '';
473 bool isConstructor = false; 475 bool isConstructor = false;
474 if (elementOrSelector is Selector) { 476 if (elementOrSelector is Selector) {
475 CallStructure callStructure = elementOrSelector.callStructure; 477 CallStructure callStructure = elementOrSelector.callStructure;
476 positionalParameterCount = callStructure.positionalArgumentCount; 478 positionalParameterCount = callStructure.positionalArgumentCount;
477 namedArguments = namedParametersAsReflectionNames(callStructure); 479 namedArguments = namedParametersAsReflectionNames(callStructure);
478 } else { 480 } else {
479 FunctionElement function = elementOrSelector; 481 MethodElement function = elementOrSelector;
480 if (function.isConstructor) { 482 if (function.isConstructor) {
481 isConstructor = true; 483 isConstructor = true;
482 name = Elements.reconstructConstructorName(function); 484 name = Elements.reconstructConstructorName(function);
483 } 485 }
484 FunctionSignature signature = function.functionSignature; 486 FunctionSignature signature = function.functionSignature;
485 positionalParameterCount = signature.requiredParameterCount; 487 positionalParameterCount = signature.requiredParameterCount;
486 if (signature.optionalParametersAreNamed) { 488 if (signature.optionalParametersAreNamed) {
487 var names = []; 489 var names = [];
488 for (Element e in signature.optionalParameters) { 490 for (Element e in signature.optionalParameters) {
489 names.add(e.name); 491 names.add(e.name);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 reporter.withCurrentElement(classElement, () { 559 reporter.withCurrentElement(classElement, () {
558 classEmitter.emitClass(cls, enclosingBuilder, fragment); 560 classEmitter.emitClass(cls, enclosingBuilder, fragment);
559 }); 561 });
560 } 562 }
561 563
562 void assembleStaticFunctions( 564 void assembleStaticFunctions(
563 Iterable<Method> staticFunctions, Fragment fragment) { 565 Iterable<Method> staticFunctions, Fragment fragment) {
564 if (staticFunctions == null) return; 566 if (staticFunctions == null) return;
565 567
566 for (Method method in staticFunctions) { 568 for (Method method in staticFunctions) {
567 MethodElement element = method.element; 569 FunctionEntity element = method.element;
568 // We need to filter out null-elements for the interceptors. 570 // We need to filter out null-elements for the interceptors.
569 // TODO(floitsch): use the precomputed interceptors here. 571 // TODO(floitsch): use the precomputed interceptors here.
570 if (element == null) continue; 572 if (element == null) continue;
571 ClassBuilder builder = new ClassBuilder.forStatics(element, namer); 573 ClassBuilder builder = new ClassBuilder.forStatics(element, namer);
572 containerBuilder.addMemberMethod(method, builder); 574 containerBuilder.addMemberMethod(method, builder);
573 getStaticMethodDescriptor(element, fragment) 575 getStaticMethodDescriptor(element, fragment)
574 .properties 576 .properties
575 .addAll(builder.properties); 577 .addAll(builder.properties);
576 } 578 }
577 } 579 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 } catch(_) {} 1005 } catch(_) {}
1004 1006
1005 return false; 1007 return false;
1006 })(); 1008 })();
1007 '''); 1009 ''');
1008 1010
1009 return supportsDirectProtoAccess; 1011 return supportsDirectProtoAccess;
1010 } 1012 }
1011 1013
1012 jsAst.Expression generateLibraryDescriptor( 1014 jsAst.Expression generateLibraryDescriptor(
1013 LibraryElement library, Fragment fragment) { 1015 LibraryEntity library, Fragment fragment) {
1014 var uri = ""; 1016 var uri = "";
1015 if (!compiler.options.enableMinification || 1017 if (!compiler.options.enableMinification ||
1016 backend.mirrorsData.mustPreserveUris) { 1018 backend.mirrorsData.mustPreserveUris) {
1017 uri = library.canonicalUri; 1019 uri = library.canonicalUri;
1018 if (uri.scheme == 'file' && compiler.options.outputUri != null) { 1020 if (uri.scheme == 'file' && compiler.options.outputUri != null) {
1019 uri = 1021 uri =
1020 relativize(compiler.options.outputUri, library.canonicalUri, false); 1022 relativize(compiler.options.outputUri, library.canonicalUri, false);
1021 } 1023 }
1022 } 1024 }
1023 1025
1024 String libraryName = (!compiler.options.enableMinification || 1026 String libraryName = (!compiler.options.enableMinification ||
1025 backend.mirrorsData.mustRetainLibraryNames) 1027 backend.mirrorsData.mustRetainLibraryNames)
1026 ? library.libraryName 1028 // TODO(johnniwinther): Support library names for entities.
1029 ? library is LibraryElement ? library.libraryName : library.name
1027 : ""; 1030 : "";
1028 1031
1029 jsAst.Fun metadata = 1032 jsAst.Fun metadata =
1030 task.metadataCollector.buildLibraryMetadataFunction(library); 1033 task.metadataCollector.buildLibraryMetadataFunction(library);
1031 1034
1032 ClassBuilder descriptor = elementDescriptors[fragment][library]; 1035 ClassBuilder descriptor = libraryDescriptors[fragment][library];
1033 1036
1034 jsAst.ObjectInitializer initializer; 1037 jsAst.ObjectInitializer initializer;
1035 if (descriptor == null) { 1038 if (descriptor == null) {
1036 // Nothing of the library was emitted. 1039 // Nothing of the library was emitted.
1037 // TODO(floitsch): this should not happen. We currently have an example 1040 // TODO(floitsch): this should not happen. We currently have an example
1038 // with language/prefix6_negative_test.dart where we have an instance 1041 // with language/prefix6_negative_test.dart where we have an instance
1039 // method without its corresponding class. 1042 // method without its corresponding class.
1040 initializer = new jsAst.ObjectInitializer([]); 1043 initializer = new jsAst.ObjectInitializer([]);
1041 } else { 1044 } else {
1042 initializer = descriptor.toObjectInitializer(); 1045 initializer = descriptor.toObjectInitializer();
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 } 1259 }
1257 jsAst.Expression mangledGlobalNamesAccess = 1260 jsAst.Expression mangledGlobalNamesAccess =
1258 generateEmbeddedGlobalAccess(embeddedNames.MANGLED_GLOBAL_NAMES); 1261 generateEmbeddedGlobalAccess(embeddedNames.MANGLED_GLOBAL_NAMES);
1259 jsAst.ObjectInitializer map = new jsAst.ObjectInitializer(properties); 1262 jsAst.ObjectInitializer map = new jsAst.ObjectInitializer(properties);
1260 parts.add(js.statement('# = #', [mangledGlobalNamesAccess, map])); 1263 parts.add(js.statement('# = #', [mangledGlobalNamesAccess, map]));
1261 } 1264 }
1262 1265
1263 return new jsAst.Block(parts); 1266 return new jsAst.Block(parts);
1264 } 1267 }
1265 1268
1266 void checkEverythingEmitted(Iterable<Element> elements) { 1269 void checkEverythingEmitted(Map<ClassEntity, ClassBuilder> classes) {
Siggi Cherem (dart-lang) 2017/05/30 22:10:20 nit: classes => pendingClassBuilders pendingS
Johnni Winther 2017/05/31 08:19:31 Done.
1267 List<Element> pendingStatics = 1270 if (classes == null) return;
1268 Elements.sortedByPosition(elements.where((e) => !e.isLibrary)); 1271 List<ClassEntity> pendingStatics = _sorter.sortClasses(classes.keys);
1269 1272
1270 pendingStatics.forEach((element) => reporter.reportInfo( 1273 pendingStatics.forEach((ClassEntity element) => reporter.reportInfo(
1271 element, MessageKind.GENERIC, {'text': 'Pending statics.'})); 1274 element, MessageKind.GENERIC, {'text': 'Pending statics.'}));
1272 1275
1273 if (pendingStatics != null && !pendingStatics.isEmpty) { 1276 if (pendingStatics != null && !pendingStatics.isEmpty) {
1274 reporter.internalError( 1277 reporter.internalError(
1275 pendingStatics.first, 'Pending statics (see above).'); 1278 pendingStatics.first, 'Pending statics (see above).');
1276 } 1279 }
1277 } 1280 }
1278 1281
1279 void assembleLibrary(Library library, Fragment fragment) { 1282 void assembleLibrary(Library library, Fragment fragment) {
1280 LibraryElement libraryElement = library.element; 1283 LibraryEntity libraryElement = library.element;
1281 1284
1282 assembleStaticFunctions(library.statics, fragment); 1285 assembleStaticFunctions(library.statics, fragment);
1283 1286
1284 ClassBuilder libraryBuilder = 1287 ClassBuilder libraryBuilder =
1285 getLibraryDescriptor(libraryElement, fragment); 1288 getLibraryDescriptor(libraryElement, fragment);
1286 for (Class cls in library.classes) { 1289 for (Class cls in library.classes) {
1287 assembleClass(cls, libraryBuilder, fragment); 1290 assembleClass(cls, libraryBuilder, fragment);
1288 } 1291 }
1289 1292
1290 classEmitter.emitFields(library, libraryBuilder, emitStatics: true); 1293 classEmitter.emitFields(library, libraryBuilder, emitStatics: true);
(...skipping 27 matching lines...) Expand all
1318 1321
1319 List<jsAst.Statement> statements = <jsAst.Statement>[]; 1322 List<jsAst.Statement> statements = <jsAst.Statement>[];
1320 1323
1321 statements..add(buildGeneratedBy())..add(js.comment(HOOKS_API_USAGE)); 1324 statements..add(buildGeneratedBy())..add(js.comment(HOOKS_API_USAGE));
1322 1325
1323 if (isProgramSplit) { 1326 if (isProgramSplit) {
1324 statements.add(buildDeferredHeader()); 1327 statements.add(buildDeferredHeader());
1325 } 1328 }
1326 1329
1327 // Collect the AST for the descriptors. 1330 // Collect the AST for the descriptors.
1328 Map<Element, ClassBuilder> descriptors = elementDescriptors[mainFragment]; 1331 Map<LibraryEntity, ClassBuilder> descriptors =
1329 if (descriptors == null) descriptors = const {}; 1332 libraryDescriptors[mainFragment] ?? const {};
1330 1333
1331 checkEverythingEmitted(descriptors.keys); 1334 checkEverythingEmitted(classDescriptors[mainFragment]);
1332 1335
1333 Iterable<LibraryEntity> libraries = outputLibraryLists[mainOutputUnit]; 1336 Iterable<LibraryEntity> libraries = outputLibraryLists[mainOutputUnit];
1334 if (libraries == null) libraries = <LibraryElement>[]; 1337 if (libraries == null) libraries = <LibraryEntity>[];
1335 1338
1336 List<jsAst.Expression> parts = <jsAst.Expression>[]; 1339 List<jsAst.Expression> parts = <jsAst.Expression>[];
1337 for (LibraryEntity library in _sorter.sortLibraries(libraries)) { 1340 for (LibraryEntity library in _sorter.sortLibraries(libraries)) {
1338 parts.add(generateLibraryDescriptor(library, mainFragment)); 1341 parts.add(generateLibraryDescriptor(library, mainFragment));
1339 descriptors.remove(library); 1342 descriptors.remove(library);
1340 } 1343 }
1341 1344
1342 if (descriptors.isNotEmpty) { 1345 if (descriptors.isNotEmpty) {
1343 List<Element> remainingLibraries = 1346 List<LibraryEntity> remainingLibraries = descriptors.keys.toList();
1344 descriptors.keys.where((Element e) => e is LibraryElement).toList();
1345 1347
1346 // The remaining descriptors are only accessible through reflection. 1348 // The remaining descriptors are only accessible through reflection.
1347 // The program builder does not collect libraries that only 1349 // The program builder does not collect libraries that only
1348 // contain typedefs that are used for reflection. 1350 // contain typedefs that are used for reflection.
1349 for (LibraryElement element in remainingLibraries) { 1351 for (LibraryEntity element in remainingLibraries) {
1350 assert(element is LibraryElement); 1352 parts.add(generateLibraryDescriptor(element, mainFragment));
1351 if (element is LibraryElement) { 1353 descriptors.remove(element);
1352 parts.add(generateLibraryDescriptor(element, mainFragment));
1353 descriptors.remove(element);
1354 }
1355 } 1354 }
1356 } 1355 }
1357 jsAst.ArrayInitializer descriptorsAst = new jsAst.ArrayInitializer(parts); 1356 jsAst.ArrayInitializer descriptorsAst = new jsAst.ArrayInitializer(parts);
1358 1357
1359 // Using a named function here produces easier to read stack traces in 1358 // Using a named function here produces easier to read stack traces in
1360 // Chrome/V8. 1359 // Chrome/V8.
1361 statements.add(js.statement( 1360 statements.add(js.statement(
1362 """ 1361 """
1363 (function() { 1362 (function() {
1364 // No renaming in the top-level function to save the locals for the 1363 // No renaming in the top-level function to save the locals for the
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 } 1540 }
1542 1541
1543 Map<OutputUnit, jsAst.Expression> buildDescriptorsForOutputUnits( 1542 Map<OutputUnit, jsAst.Expression> buildDescriptorsForOutputUnits(
1544 Program program) { 1543 Program program) {
1545 Map<OutputUnit, jsAst.Expression> outputs = 1544 Map<OutputUnit, jsAst.Expression> outputs =
1546 new Map<OutputUnit, jsAst.Expression>(); 1545 new Map<OutputUnit, jsAst.Expression>();
1547 1546
1548 for (Fragment fragment in program.deferredFragments) { 1547 for (Fragment fragment in program.deferredFragments) {
1549 OutputUnit outputUnit = fragment.outputUnit; 1548 OutputUnit outputUnit = fragment.outputUnit;
1550 1549
1551 Map<Element, ClassBuilder> descriptors = elementDescriptors[fragment]; 1550 Map<LibraryEntity, ClassBuilder> descriptors =
1551 libraryDescriptors[fragment];
1552 1552
1553 if (descriptors != null && descriptors.isNotEmpty) { 1553 if (descriptors != null && descriptors.isNotEmpty) {
1554 Iterable<LibraryEntity> libraries = outputLibraryLists[outputUnit]; 1554 Iterable<LibraryEntity> libraries = outputLibraryLists[outputUnit];
1555 if (libraries == null) libraries = []; 1555 if (libraries == null) libraries = <LibraryEntity>[];
1556 1556
1557 // TODO(johnniwinther): Avoid creating [CodeBuffer]s. 1557 // TODO(johnniwinther): Avoid creating [CodeBuffer]s.
1558 List<jsAst.Expression> parts = <jsAst.Expression>[]; 1558 List<jsAst.Expression> parts = <jsAst.Expression>[];
1559 for (LibraryEntity library in _sorter.sortLibraries(libraries)) { 1559 for (LibraryEntity library in _sorter.sortLibraries(libraries)) {
1560 parts.add(generateLibraryDescriptor(library, fragment)); 1560 parts.add(generateLibraryDescriptor(library, fragment));
1561 descriptors.remove(library); 1561 descriptors.remove(library);
1562 } 1562 }
1563 1563
1564 outputs[outputUnit] = new jsAst.ArrayInitializer(parts); 1564 outputs[outputUnit] = new jsAst.ArrayInitializer(parts);
1565 } 1565 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 1622
1623 if (_closedWorld.backendUsage.requiresPreamble && 1623 if (_closedWorld.backendUsage.requiresPreamble &&
1624 !backend.htmlLibraryIsLoaded) { 1624 !backend.htmlLibraryIsLoaded) {
1625 reporter.reportHintMessage(NO_LOCATION_SPANNABLE, MessageKind.PREAMBLE); 1625 reporter.reportHintMessage(NO_LOCATION_SPANNABLE, MessageKind.PREAMBLE);
1626 } 1626 }
1627 // Return the total program size. 1627 // Return the total program size.
1628 return outputBuffers.values.fold(0, (a, b) => a + b.length); 1628 return outputBuffers.values.fold(0, (a, b) => a + b.length);
1629 } 1629 }
1630 1630
1631 ClassBuilder getStaticMethodDescriptor( 1631 ClassBuilder getStaticMethodDescriptor(
1632 MethodElement element, Fragment fragment) { 1632 FunctionEntity element, Fragment fragment) {
1633 Element owner = element.library;
1634 if (!_nativeData.isNativeMember(element)) { 1633 if (!_nativeData.isNativeMember(element)) {
1635 // For static (not top level) elements, record their code in a buffer 1634 // For static (not top level) elements, record their code in a buffer
1636 // specific to the class. For now, not supported for native classes and 1635 // specific to the class. For now, not supported for native classes and
1637 // native elements. 1636 // native elements.
1638 ClassElement cls = element.enclosingClass; 1637 ClassEntity cls = element.enclosingClass;
1639 if (compiler.codegenWorldBuilder.directlyInstantiatedClasses 1638 if (compiler.codegenWorldBuilder.directlyInstantiatedClasses
1640 .contains(cls) && 1639 .contains(cls) &&
1641 !_nativeData.isNativeClass(cls) && 1640 !_nativeData.isNativeClass(cls) &&
1642 compiler.deferredLoadTask.outputUnitForElement(element) == 1641 compiler.deferredLoadTask.outputUnitForMember(element) ==
1643 compiler.deferredLoadTask.outputUnitForElement(cls)) { 1642 compiler.deferredLoadTask.outputUnitForClass(cls)) {
1644 owner = cls; 1643 return classDescriptors
1644 .putIfAbsent(fragment, () => new Map<ClassEntity, ClassBuilder>())
1645 .putIfAbsent(cls, () {
1646 return new ClassBuilder.forClass(cls, namer);
1647 });
1645 } 1648 }
1646 } 1649 }
1647 return _getElementDescriptor(element, owner, fragment); 1650 return _getLibraryDescriptor(element, element.library, fragment);
1648 } 1651 }
1649 1652
1650 ClassBuilder getLibraryDescriptor(LibraryElement element, Fragment fragment) { 1653 ClassBuilder getLibraryDescriptor(LibraryEntity element, Fragment fragment) {
1651 return _getElementDescriptor(element, element, fragment); 1654 return _getLibraryDescriptor(element, element, fragment);
1652 } 1655 }
1653 1656
1654 ClassBuilder _getElementDescriptor( 1657 ClassBuilder _getLibraryDescriptor(
1655 Element element, Element owner, Fragment fragment) { 1658 Entity element, LibraryEntity owner, Fragment fragment) {
1656 if (owner == null) { 1659 if (owner == null) {
1657 reporter.internalError(element, 'Owner is null.'); 1660 reporter.internalError(element, 'Owner is null.');
1658 } 1661 }
1659 return elementDescriptors 1662 return libraryDescriptors
1660 .putIfAbsent(fragment, () => new Map<Element, ClassBuilder>()) 1663 .putIfAbsent(fragment, () => new Map<LibraryEntity, ClassBuilder>())
1661 .putIfAbsent(owner, () { 1664 .putIfAbsent(owner, () {
1662 return new ClassBuilder(owner, namer, owner.isClass); 1665 return new ClassBuilder.forLibrary(owner, namer);
1663 }); 1666 });
1664 } 1667 }
1665 1668
1666 /// Emits support-code for deferred loading into [output]. 1669 /// Emits support-code for deferred loading into [output].
1667 jsAst.Statement buildDeferredBoilerPlate( 1670 jsAst.Statement buildDeferredBoilerPlate(
1668 Map<OutputUnit, _DeferredOutputUnitHash> deferredLoadHashes) { 1671 Map<OutputUnit, _DeferredOutputUnitHash> deferredLoadHashes) {
1669 List<jsAst.Statement> parts = <jsAst.Statement>[]; 1672 List<jsAst.Statement> parts = <jsAst.Statement>[];
1670 1673
1671 parts.add(js.statement( 1674 parts.add(js.statement(
1672 ''' 1675 '''
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 // data. 1914 // data.
1912 mapping["_comment"] = "This mapping shows which compiled `.js` files are " 1915 mapping["_comment"] = "This mapping shows which compiled `.js` files are "
1913 "needed for a given deferred library import."; 1916 "needed for a given deferred library import.";
1914 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); 1917 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap());
1915 compiler.outputProvider( 1918 compiler.outputProvider(
1916 compiler.options.deferredMapUri.path, '', OutputType.info) 1919 compiler.options.deferredMapUri.path, '', OutputType.info)
1917 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) 1920 ..add(const JsonEncoder.withIndent(" ").convert(mapping))
1918 ..close(); 1921 ..close();
1919 } 1922 }
1920 } 1923 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698