diff --git a/pkg/compiler/lib/src/io/code_output.dart b/pkg/compiler/lib/src/io/code_output.dart index 70ad22cdcb9..d7342ef79ee 100644 --- a/pkg/compiler/lib/src/io/code_output.dart +++ b/pkg/compiler/lib/src/io/code_output.dart @@ -143,10 +143,6 @@ abstract class CodeOutput implements SourceLocationsProvider { } abstract class AbstractCodeOutput extends CodeOutput { - final List _listeners; - - AbstractCodeOutput([this._listeners]); - Map sourceLocationsMap = {}; @override @@ -154,17 +150,12 @@ abstract class AbstractCodeOutput extends CodeOutput { void _addInternal(String text); - void _add(String text) { - _addInternal(text); - _listeners?.forEach((listener) => listener.onText(text)); - } - @override void add(String text) { if (isClosed) { throw new StateError("Code output is closed. Trying to write '$text'."); } - _add(text); + _addInternal(text); } @override @@ -175,7 +166,7 @@ abstract class AbstractCodeOutput extends CodeOutput { if (!other.isClosed) { other.close(); } - _add(other.getText()); + _addInternal(other.getText()); } @override @@ -184,7 +175,6 @@ abstract class AbstractCodeOutput extends CodeOutput { throw new StateError("Code output is already closed."); } isClosed = true; - _listeners?.forEach((listener) => listener.onDone(length)); } @override @@ -204,8 +194,6 @@ abstract class BufferedCodeOutput { class CodeBuffer extends AbstractCodeOutput implements BufferedCodeOutput { StringBuffer buffer = new StringBuffer(); - CodeBuffer([List listeners]) : super(listeners); - @override void _addInternal(String text) { buffer.write(text); @@ -230,19 +218,25 @@ class StreamCodeOutput extends AbstractCodeOutput { @override int length = 0; final OutputSink output; + final List _listeners; - StreamCodeOutput(this.output, [List listeners]) - : super(listeners); + StreamCodeOutput(this.output, [this._listeners]); @override void _addInternal(String text) { output.add(text); length += text.length; + if (_listeners != null) { + _listeners.forEach((listener) => listener.onText(text)); + } } @override void close() { output.close(); super.close(); + if (_listeners != null) { + _listeners.forEach((listener) => listener.onDone(length)); + } } } diff --git a/pkg/compiler/lib/src/js/js.dart b/pkg/compiler/lib/src/js/js.dart index 451852191cf..dd31e3b8061 100644 --- a/pkg/compiler/lib/src/js/js.dart +++ b/pkg/compiler/lib/src/js/js.dart @@ -9,7 +9,7 @@ import 'package:js_ast/js_ast.dart'; import '../common.dart'; import '../options.dart'; import '../dump_info.dart' show DumpInfoTask; -import '../io/code_output.dart' show CodeBuffer, CodeOutputListener; +import '../io/code_output.dart' show CodeBuffer; import 'js_source_mapping.dart'; export 'package:js_ast/js_ast.dart'; @@ -38,13 +38,12 @@ CodeBuffer createCodeBuffer(Node node, CompilerOptions compilerOptions, JavaScriptSourceInformationStrategy sourceInformationStrategy, {DumpInfoTask monitor, bool allowVariableMinification: true, - Renamer renamerForNames: JavaScriptPrintingOptions.identityRenamer, - List listeners: const []}) { + Renamer renamerForNames: JavaScriptPrintingOptions.identityRenamer}) { JavaScriptPrintingOptions options = new JavaScriptPrintingOptions( shouldCompressOutput: compilerOptions.enableMinification, minifyLocalVariables: allowVariableMinification, renamerForNames: renamerForNames); - CodeBuffer outBuffer = new CodeBuffer(listeners); + CodeBuffer outBuffer = new CodeBuffer(); SourceInformationProcessor sourceInformationProcessor = sourceInformationStrategy.createProcessor( new SourceMapperProviderImpl(outBuffer), diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart index ac5714bc656..b85031c0722 100644 --- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart +++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart @@ -1894,16 +1894,11 @@ class FragmentEmitter { void finalizeDeferredLoadingData( Map> codeFragmentsToLoad, Map codeFragmentMap, - Map deferredLoadHashes, + Map deferredLoadHashes, DeferredLoadingState deferredLoadingState) { if (codeFragmentsToLoad.isEmpty) return; - // We store a map of indices to uris and hashes. Because multiple - // [CodeFragments] can map to a single file, a uri may appear multiple times - // in [fragmentUris] once per [CodeFragment] reference in that file. - // TODO(joshualitt): Use a string table to avoid duplicating part file - // names. - Map fragmentIndexes = {}; + Map fragmentIndexes = {}; List fragmentUris = []; List fragmentHashes = []; @@ -1914,14 +1909,14 @@ class FragmentEmitter { List indexes = []; for (var codeFragment in codeFragments) { var fragment = codeFragmentMap[codeFragment]; - String codeFragmentHash = deferredLoadHashes[codeFragment]; - if (codeFragmentHash == null) continue; - int index = fragmentIndexes[codeFragment]; + String fragmentHash = deferredLoadHashes[fragment]; + if (fragmentHash == null) continue; + int index = fragmentIndexes[fragment]; if (index == null) { - index = fragmentIndexes[codeFragment] = fragmentIndexes.length; + index = fragmentIndexes[fragment] = fragmentIndexes.length; fragmentUris.add( "${fragment.outputFileName}.${ModelEmitter.deferredExtension}"); - fragmentHashes.add(codeFragmentHash); + fragmentHashes.add(fragmentHash); } indexes.add(js.number(index)); } diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_merger.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_merger.dart index 3174eb4afff..8eefc10d6de 100644 --- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_merger.dart +++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_merger.dart @@ -165,8 +165,7 @@ class PreFragment { final Set predecessors = {}; FinalizedFragment finalizedFragment; int size = 0; - // TODO(joshualitt): interleave dynamically when it makes sense. - bool shouldInterleave = false; + bool shouldInterleave = true; PreFragment( this.outputFileName, EmittedOutputUnit emittedOutputUnit, this.size) { diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart index 2b23a2c4eb3..97b7f0d6d12 100644 --- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart +++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart @@ -270,20 +270,22 @@ class ModelEmitter { // Finalize and emit fragments. Map outputUnitMap = {}; Map codeFragmentMap = {}; - Map> deferredFragmentsCode = - {}; + Map deferredFragmentsCode = {}; for (var preDeferredFragment in preDeferredFragments) { var finalizedFragment = preDeferredFragment.finalize(program, outputUnitMap, codeFragmentMap); - for (var codeFragment in finalizedFragment.codeFragments) { - js.Expression fragmentCode = - fragmentEmitter.emitCodeFragment(codeFragment, program.holders); - if (fragmentCode != null) { - (deferredFragmentsCode[finalizedFragment] ??= []) - .add(EmittedCodeFragment(codeFragment, fragmentCode)); - } else { + // TODO(joshualitt): Support bundling. + assert(finalizedFragment.codeFragments.length == 1); + var codeFragment = finalizedFragment.codeFragments.single; + js.Expression fragmentCode = + fragmentEmitter.emitCodeFragment(codeFragment, program.holders); + if (fragmentCode != null) { + deferredFragmentsCode[finalizedFragment] = + EmittedCodeFragment(codeFragment, fragmentCode); + } else { + finalizedFragment.codeFragments.forEach((codeFragment) { omittedOutputUnits.addAll(codeFragment.outputUnits); - } + }); } } @@ -304,11 +306,9 @@ class ModelEmitter { // Count tokens and run finalizers. js.TokenCounter counter = new js.TokenCounter(); - for (var emittedFragments in deferredFragmentsCode.values) { - for (var emittedFragment in emittedFragments) { - counter.countTokens(emittedFragment.code); - } - } + deferredFragmentsCode.values.forEach((emittedCodeFragment) { + counter.countTokens(emittedCodeFragment.code); + }); counter.countTokens(mainCode); program.finalizers.forEach((js.TokenFinalizer f) => f.finalizeTokens()); @@ -317,15 +317,15 @@ class ModelEmitter { // deferred ASTs inside the parts) have any contents. We should wait until // this point to decide if a part is empty. - Map codeFragmentHashes = + Map hunkHashes = _task.measureSubtask('write fragments', () { - return writeFinalizedFragments(deferredFragmentsCode); + return writeDeferredFragments(deferredFragmentsCode); }); // Now that we have written the deferred hunks, we can create the deferred // loading data. - fragmentEmitter.finalizeDeferredLoadingData(codeFragmentsToLoad, - codeFragmentMap, codeFragmentHashes, deferredLoadingState); + fragmentEmitter.finalizeDeferredLoadingData( + codeFragmentsToLoad, codeFragmentMap, hunkHashes, deferredLoadingState); _task.measureSubtask('write fragments', () { writeMainFragment(mainFragment, mainCode, @@ -362,6 +362,25 @@ class ModelEmitter { return new js.Comment(generatedBy(_options, flavor: '$flavor')); } + /// Writes all deferred fragment's code into files. + /// + /// Returns a map from fragment to its hashcode (as used for the deferred + /// library code). + /// + /// Updates the shared [outputBuffers] field with the output. + Map writeDeferredFragments( + Map fragmentsCode) { + Map hunkHashes = {}; + + fragmentsCode.forEach( + (FinalizedFragment fragment, EmittedCodeFragment emittedCodeFragment) { + hunkHashes[fragment] = + writeDeferredFragment(fragment, emittedCodeFragment.code); + }); + + return hunkHashes; + } + js.Statement buildDeferredInitializerGlobal() { return js.js.statement( 'self.#deferredInitializers = ' @@ -426,24 +445,16 @@ class ModelEmitter { } } - /// Writes all [FinalizedFragments] to files, returning a map of - /// [CodeFragment] to their initialization hashes. - Map writeFinalizedFragments( - Map> fragmentsCode) { - Map fragmentHashes = {}; - fragmentsCode.forEach((fragment, code) { - writeFinalizedFragment(fragment, code, fragmentHashes); - }); - return fragmentHashes; - } - - /// Writes a single [FinalizedFragment] and all of its [CodeFragments] to - /// file, updating the [fragmentHashes] map as necessary. - void writeFinalizedFragment( - FinalizedFragment fragment, - List fragmentCode, - Map fragmentHashes) { + // Writes the given [fragment]'s [code] into a file. + // + // Returns the deferred fragment's hash. + // + // Updates the shared [outputBuffers] field with the output. + String writeDeferredFragment(FinalizedFragment fragment, js.Expression code) { List outputListeners = []; + Hasher hasher = new Hasher(); + outputListeners.add(hasher); + LocationCollector locationCollector; if (_shouldGenerateSourceMap) { _task.measureSubtask('source-maps', () { @@ -452,21 +463,55 @@ class ModelEmitter { }); } - String outputFileName = fragment.outputFileName; - CodeOutput output = StreamCodeOutput( + String hunkPrefix = fragment.outputFileName; + + CodeOutput output = new StreamCodeOutput( _outputProvider.createOutputSink( - outputFileName, deferredExtension, OutputType.jsPart), + hunkPrefix, deferredExtension, OutputType.jsPart), outputListeners); - writeCodeFragments(fragmentCode, fragmentHashes, output); + // TODO(joshualitt): This breaks dump_info when we merge, but fixing it will + // require updating the schema. + emittedOutputBuffers[fragment.canonicalOutputUnit] = output; + + // The [code] contains the function that must be invoked when the deferred + // hunk is loaded. + // That function must be in a map from its hashcode to the function. Since + // we don't know the hash before we actually emit the code we store the + // function in a temporary field first: + // + // deferredInitializer.current = ; + // deferredInitializer[] = deferredInitializer.current; + + js.Program program = new js.Program([ + buildGeneratedBy(), + buildDeferredInitializerGlobal(), + js.js.statement('$deferredInitializersGlobal.current = #', code) + ]); + + CodeBuffer buffer = js.createCodeBuffer( + program, _options, _sourceInformationStrategy, + monitor: _dumpInfoTask); + _task.measureSubtask('emit buffers', () { + output.addBuffer(buffer); + }); + + // Make a unique hash of the code (before the sourcemaps are added) + // This will be used to retrieve the initializing function from the global + // variable. + String hash = hasher.getHash(); + + // Now we copy the deferredInitializer.current into its correct hash. + output.add('\n${deferredInitializersGlobal}["$hash"] = ' + '${deferredInitializersGlobal}.current'); if (_shouldGenerateSourceMap) { _task.measureSubtask('source-maps', () { Uri mapUri, partUri; Uri sourceMapUri = _options.sourceMapUri; Uri outputUri = _options.outputUri; - String partName = "$outputFileName.$partExtension"; - String hunkFileName = "$outputFileName.$deferredExtension"; + String partName = "$hunkPrefix.$partExtension"; + String hunkFileName = "$hunkPrefix.$deferredExtension"; if (sourceMapUri != null) { String mapFileName = hunkFileName + ".map"; @@ -489,61 +534,7 @@ class ModelEmitter { } else { output.close(); } - } - /// Writes a list of [CodeFragments] to [CodeOutput]. - void writeCodeFragments(List fragmentCode, - Map fragmentHashes, CodeOutput output) { - bool isFirst = true; - for (var emittedCodeFragment in fragmentCode) { - var codeFragment = emittedCodeFragment.codeFragment; - var code = emittedCodeFragment.code; - for (var outputUnit in codeFragment.outputUnits) { - emittedOutputBuffers[outputUnit] = output; - } - fragmentHashes[codeFragment] = writeCodeFragment(output, code, isFirst); - isFirst = false; - } - } - - // Writes the given [fragment]'s [code] into a file. - // - // Returns the deferred fragment's hash. - // - // Updates the shared [outputBuffers] field with the output. - String writeCodeFragment( - CodeOutput output, js.Expression code, bool isFirst) { - // The [code] contains the function that must be invoked when the deferred - // hunk is loaded. - // That function must be in a map from its hashcode to the function. Since - // we don't know the hash before we actually emit the code we store the - // function in a temporary field first: - // - // deferredInitializer.current = ; - // deferredInitializer[] = deferredInitializer.current; - - js.Program program = new js.Program([ - if (isFirst) buildGeneratedBy(), - if (isFirst) buildDeferredInitializerGlobal(), - js.js.statement('$deferredInitializersGlobal.current = #', code) - ]); - - Hasher hasher = new Hasher(); - CodeBuffer buffer = js.createCodeBuffer( - program, _options, _sourceInformationStrategy, - monitor: _dumpInfoTask, listeners: [hasher]); - _task.measureSubtask('emit buffers', () { - output.addBuffer(buffer); - }); - - // Make a unique hash of the code (before the sourcemaps are added) - // This will be used to retrieve the initializing function from the global - // variable. - String hash = hasher.getHash(); - - // Now we copy the deferredInitializer.current into its correct hash. - output.add('\n${deferredInitializersGlobal}["$hash"] = ' - '${deferredInitializersGlobal}.current\n'); return hash; } diff --git a/pkg/compiler/test/deferred_loading/data/components/main.dart b/pkg/compiler/test/deferred_loading/data/components/main.dart index c576a7db3d0..d5ac6459122 100644 --- a/pkg/compiler/test/deferred_loading/data/components/main.dart +++ b/pkg/compiler/test/deferred_loading/data/components/main.dart @@ -32,8 +32,8 @@ p3: {units: [3{libB, libC, libD, libE}, 6{libE}], usedBy: [], needs: [p2]}], b_finalized_fragments=[ f1: [1{libA}], - f2: [5{libD}, 4{libC}, 2{libB}], - f3: [3{libB, libC, libD, libE}, 6{libE}]], + f2: [5{libD}+4{libC}+2{libB}], + f3: [3{libB, libC, libD, libE}+6{libE}]], c_steps=[ libA=(f1), libB=(f3, f2), @@ -50,8 +50,8 @@ p4: {units: [3{libB, libC, libD, libE}], usedBy: [], needs: [p2, p3]}], b_finalized_fragments=[ f1: [1{libA}], - f2: [4{libC}, 2{libB}], - f3: [6{libE}, 5{libD}], + f2: [4{libC}+2{libB}], + f3: [6{libE}+5{libD}], f4: [3{libB, libC, libD, libE}]], c_steps=[ libA=(f1), diff --git a/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/main.dart b/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/main.dart index e9ddf008594..8a5fa122f3a 100644 --- a/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/main.dart +++ b/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/main.dart @@ -36,7 +36,7 @@ p2: {units: [2{lib1, lib2}, 3{lib2}], usedBy: [], needs: [p1]}], b_finalized_fragments=[ f1: [1{lib1}], - f2: [2{lib1, lib2}, 3{lib2}]], + f2: [2{lib1, lib2}+3{lib2}]], c_steps=[ lib1=(f2, f1), lib2=(f2)] diff --git a/pkg/compiler/test/deferred_loading/data/lazy_types/main.dart b/pkg/compiler/test/deferred_loading/data/lazy_types/main.dart index a5d40abeded..2efbbd6c39a 100644 --- a/pkg/compiler/test/deferred_loading/data/lazy_types/main.dart +++ b/pkg/compiler/test/deferred_loading/data/lazy_types/main.dart @@ -14,6 +14,8 @@ f1: [6{libA}], f2: [1{libB}], f3: [2{libC}], + f4: [], + f5: [], f6: [3{libA, libB, libC}]], c_steps=[ libA=(f6, f1), @@ -27,12 +29,12 @@ p2: {units: [5{libB, libC}, 4{libA, libC}, 2{libC}], usedBy: [p3], needs: [p1]}, p3: {units: [3{libA, libB, libC}], usedBy: [], needs: [p2]}], b_finalized_fragments=[ - f1: [1{libB}, 6{libA}], - f2: [2{libC}], + f1: [1{libB}+6{libA}], + f2: [5{libB, libC}+4{libA, libC}+2{libC}], f3: [3{libA, libB, libC}]], c_steps=[ - libA=(f3, f1), - libB=(f3, f1), + libA=(f3, f2, f1), + libB=(f3, f2, f1), libC=(f3, f2)] */ @@ -46,7 +48,7 @@ f1: [6{libA}], f2: [1{libB}], f3: [2{libC}], - f4: [3{libA, libB, libC}]], + f4: [3{libA, libB, libC}+5{libB, libC}+4{libA, libC}]], c_steps=[ libA=(f4, f1), libB=(f4, f2), diff --git a/pkg/compiler/test/deferred_loading/data/many_parts/main.dart b/pkg/compiler/test/deferred_loading/data/many_parts/main.dart index 3dfb37494b1..9471cc9e9f3 100644 --- a/pkg/compiler/test/deferred_loading/data/many_parts/main.dart +++ b/pkg/compiler/test/deferred_loading/data/many_parts/main.dart @@ -82,9 +82,9 @@ p3: {units: [24{b2, b3, b4, b5}, 16{b1, b3, b4, b5}, 15{b1, b2, b4, b5}, 13{b1, b2, b3, b5}], usedBy: [p4], needs: [p2]}, p4: {units: [1{b1, b2, b3, b4, b5}], usedBy: [], needs: [p2, p3]}], b_finalized_fragments=[ - f1: [26{b3, b4}, 21{b2, b5}, 19{b2, b4}, 18{b2, b3}, 10{b1, b5}, 6{b1, b4}, 4{b1, b3}, 3{b1, b2}, 31{b5}, 29{b4}, 25{b3}, 17{b2}, 2{b1}], - f2: [9{b1, b2, b3, b4}, 28{b3, b4, b5}, 23{b2, b4, b5}, 22{b2, b3, b5}, 20{b2, b3, b4}, 14{b1, b4, b5}, 12{b1, b3, b5}, 8{b1, b3, b4}, 11{b1, b2, b5}, 7{b1, b2, b4}, 5{b1, b2, b3}, 30{b4, b5}, 27{b3, b5}], - f3: [24{b2, b3, b4, b5}, 16{b1, b3, b4, b5}, 15{b1, b2, b4, b5}, 13{b1, b2, b3, b5}], + f1: [26{b3, b4}+21{b2, b5}+19{b2, b4}+18{b2, b3}+10{b1, b5}+6{b1, b4}+4{b1, b3}+3{b1, b2}+31{b5}+29{b4}+25{b3}+17{b2}+2{b1}], + f2: [9{b1, b2, b3, b4}+28{b3, b4, b5}+23{b2, b4, b5}+22{b2, b3, b5}+20{b2, b3, b4}+14{b1, b4, b5}+12{b1, b3, b5}+8{b1, b3, b4}+11{b1, b2, b5}+7{b1, b2, b4}+5{b1, b2, b3}+30{b4, b5}+27{b3, b5}], + f3: [24{b2, b3, b4, b5}+16{b1, b3, b4, b5}+15{b1, b2, b4, b5}+13{b1, b2, b3, b5}], f4: [1{b1, b2, b3, b4, b5}]], c_steps=[ b1=(f4, f3, f2, f1), @@ -100,8 +100,8 @@ p2: {units: [24{b2, b3, b4, b5}, 16{b1, b3, b4, b5}, 15{b1, b2, b4, b5}, 13{b1, b2, b3, b5}, 9{b1, b2, b3, b4}, 28{b3, b4, b5}, 23{b2, b4, b5}, 22{b2, b3, b5}, 20{b2, b3, b4}, 14{b1, b4, b5}, 12{b1, b3, b5}], usedBy: [p3], needs: [p1]}, p3: {units: [1{b1, b2, b3, b4, b5}], usedBy: [], needs: [p2]}], b_finalized_fragments=[ - f1: [8{b1, b3, b4}, 11{b1, b2, b5}, 7{b1, b2, b4}, 5{b1, b2, b3}, 30{b4, b5}, 27{b3, b5}, 26{b3, b4}, 21{b2, b5}, 19{b2, b4}, 18{b2, b3}, 10{b1, b5}, 6{b1, b4}, 4{b1, b3}, 3{b1, b2}, 31{b5}, 29{b4}, 25{b3}, 17{b2}, 2{b1}], - f2: [24{b2, b3, b4, b5}, 16{b1, b3, b4, b5}, 15{b1, b2, b4, b5}, 13{b1, b2, b3, b5}, 9{b1, b2, b3, b4}, 28{b3, b4, b5}, 23{b2, b4, b5}, 22{b2, b3, b5}, 20{b2, b3, b4}, 14{b1, b4, b5}, 12{b1, b3, b5}], + f1: [8{b1, b3, b4}+11{b1, b2, b5}+7{b1, b2, b4}+5{b1, b2, b3}+30{b4, b5}+27{b3, b5}+26{b3, b4}+21{b2, b5}+19{b2, b4}+18{b2, b3}+10{b1, b5}+6{b1, b4}+4{b1, b3}+3{b1, b2}+31{b5}+29{b4}+25{b3}+17{b2}+2{b1}], + f2: [24{b2, b3, b4, b5}+16{b1, b3, b4, b5}+15{b1, b2, b4, b5}+13{b1, b2, b3, b5}+9{b1, b2, b3, b4}+28{b3, b4, b5}+23{b2, b4, b5}+22{b2, b3, b5}+20{b2, b3, b4}+14{b1, b4, b5}+12{b1, b3, b5}], f3: [1{b1, b2, b3, b4, b5}]], c_steps=[ b1=(f3, f2, f1), diff --git a/pkg/compiler/test/deferred_loading/data/shadowed_types/main.dart b/pkg/compiler/test/deferred_loading/data/shadowed_types/main.dart index d32f9202ecb..92732f92c99 100644 --- a/pkg/compiler/test/deferred_loading/data/shadowed_types/main.dart +++ b/pkg/compiler/test/deferred_loading/data/shadowed_types/main.dart @@ -9,7 +9,8 @@ p3: {units: [2{libb, liba}], usedBy: [], needs: []}], b_finalized_fragments=[ f1: [3{liba}], - f2: [1{libb}]], + f2: [1{libb}], + f3: []], c_steps=[ liba=(f1), libb=(f2)] @@ -22,7 +23,8 @@ p3: {units: [2{libb, liba}], usedBy: [], needs: [p1, p2]}], b_finalized_fragments=[ f1: [3{liba}], - f2: [1{libb}]], + f2: [1{libb}], + f3: []], c_steps=[ liba=(f1), libb=(f2)] diff --git a/pkg/compiler/test/deferred_loading/data/type_arguments/main.dart b/pkg/compiler/test/deferred_loading/data/type_arguments/main.dart index 6703cb14700..367329acb7b 100644 --- a/pkg/compiler/test/deferred_loading/data/type_arguments/main.dart +++ b/pkg/compiler/test/deferred_loading/data/type_arguments/main.dart @@ -9,7 +9,8 @@ p3: {units: [3{lib1, lib3}], usedBy: [], needs: []}], b_finalized_fragments=[ f1: [1{lib1}], - f2: [2{lib3}]], + f2: [2{lib3}], + f3: []], c_steps=[ lib1=(f1), lib3=(f2)] @@ -22,7 +23,8 @@ p3: {units: [3{lib1, lib3}], usedBy: [], needs: [p1, p2]}], b_finalized_fragments=[ f1: [1{lib1}], - f2: [2{lib3}]], + f2: [2{lib3}], + f3: []], c_steps=[ lib1=(f1), lib3=(f2)] diff --git a/pkg/compiler/test/deferred_loading/deferred_loading_test.dart b/pkg/compiler/test/deferred_loading/deferred_loading_test.dart index 621ba83ec8b..342c07fb815 100644 --- a/pkg/compiler/test/deferred_loading/deferred_loading_test.dart +++ b/pkg/compiler/test/deferred_loading/deferred_loading_test.dart @@ -245,9 +245,7 @@ class PreFragmentsIrComputer extends IrDataExtractor { outputUnitStrings.add(outputUnitString(outputUnit)); } } - if (outputUnitStrings.isNotEmpty) { - supplied.add(outputUnitStrings.join('+')); - } + supplied.add(outputUnitStrings.join('+')); } if (supplied.isNotEmpty) { diff --git a/tests/web/deferred/deferred_overlapping_test.dart b/tests/web/deferred/deferred_overlapping_test.dart index fc4238f8776..f626d58aa70 100644 --- a/tests/web/deferred/deferred_overlapping_test.dart +++ b/tests/web/deferred/deferred_overlapping_test.dart @@ -10,9 +10,9 @@ import "deferred_overlapping_lib2.dart" deferred as lib2; // will fail because the base class does not exist. void main() { lib1.loadLibrary().then((_) { - print(new lib1.C1()); + var a = new lib1.C1(); lib2.loadLibrary().then((_) { - print(new lib2.C2()); + var b = new lib2.C2(); }); }); }