@@ -34,7 +34,6 @@ import 'package:vm/bytecode/options.dart' show BytecodeOptions;
3434import 'package:vm/incremental_compiler.dart' show IncrementalCompiler;
3535import 'package:vm/kernel_front_end.dart'
3636 show
37- KernelCompilationResults,
3837 asFileUri,
3938 compileToKernel,
4039 convertFileOrUriArgumentToUri,
@@ -379,21 +378,17 @@ class FrontendCompiler implements CompilerInterface {
379378 _compilerOptions = compilerOptions;
380379 _bytecodeOptions = bytecodeOptions;
381380
382- KernelCompilationResults results;
381+ Component component;
382+ Iterable <Uri > compiledSources;
383383 if (options['incremental' ]) {
384384 setVMEnvironmentDefines (environmentDefines, _compilerOptions);
385385
386386 _compilerOptions.omitPlatform = false ;
387387 _generator =
388388 generator ?? _createGenerator (new Uri .file (_initializeFromDill));
389389 await invalidateIfInitializingFromDill ();
390- Component component =
391- await _runWithPrintRedirection (() => _generator.compile ());
392- results = new KernelCompilationResults (
393- component,
394- _generator.getClassHierarchy (),
395- _generator.getCoreTypes (),
396- component.uriToSource.keys);
390+ component = await _runWithPrintRedirection (() => _generator.compile ());
391+ compiledSources = component.uriToSource.keys;
397392 } else {
398393 if (options['link-platform' ]) {
399394 // TODO(aam): Remove linkedDependencies once platform is directly embedded
@@ -403,28 +398,30 @@ class FrontendCompiler implements CompilerInterface {
403398 ];
404399 }
405400 // No bytecode at this step. Bytecode is generated later in _writePackage.
406- results = await _runWithPrintRedirection (() => compileToKernel (
401+ final results = await _runWithPrintRedirection (() => compileToKernel (
407402 _mainSource, compilerOptions,
408403 aot: options['aot' ],
409404 useGlobalTypeFlowAnalysis: options['tfa' ],
410405 environmentDefines: environmentDefines,
411406 useProtobufTreeShaker: options['protobuf-tree-shaker' ]));
407+ component = results.component;
408+ compiledSources = results.compiledSources;
412409 }
413- if (results. component != null ) {
410+ if (component != null ) {
414411 if (transformer != null ) {
415- transformer.transform (results. component);
412+ transformer.transform (component);
416413 }
417414
418- await writeDillFile (results , _kernelBinaryFilename,
415+ await writeDillFile (component , _kernelBinaryFilename,
419416 filterExternal: importDill != null );
420417
421418 _outputStream.writeln (boundaryKey);
422- await _outputDependenciesDelta (results. compiledSources);
419+ await _outputDependenciesDelta (compiledSources);
423420 _outputStream
424421 .writeln ('$boundaryKey $_kernelBinaryFilename ${errors .length }' );
425422 final String depfile = options['depfile' ];
426423 if (depfile != null ) {
427- await writeDepfile (compilerOptions.fileSystem, results. compiledSources,
424+ await writeDepfile (compilerOptions.fileSystem, compiledSources,
428425 _kernelBinaryFilename, depfile);
429426 }
430427
@@ -480,9 +477,8 @@ class FrontendCompiler implements CompilerInterface {
480477 previouslyReportedDependencies = uris;
481478 }
482479
483- writeDillFile (KernelCompilationResults results , String filename,
480+ writeDillFile (Component component , String filename,
484481 {bool filterExternal: false }) async {
485- final Component component = results.component;
486482 // Remove the cache that came either from this function or from
487483 // initializing from a kernel file.
488484 component.metadata.remove (BinaryCacheMetadataRepository .repositoryTag);
@@ -496,10 +492,10 @@ class FrontendCompiler implements CompilerInterface {
496492 if (_options['incremental' ]) {
497493 await forEachPackage (component,
498494 (String package, List <Library > libraries) async {
499- _writePackage (results , package, libraries, sink);
495+ _writePackage (component , package, libraries, sink);
500496 });
501497 } else {
502- _writePackage (results , 'main' , component.libraries, sink);
498+ _writePackage (component , 'main' , component.libraries, sink);
503499 }
504500 });
505501 await sink.close ();
@@ -606,7 +602,7 @@ class FrontendCompiler implements CompilerInterface {
606602 }
607603 }
608604
609- void _writePackage (KernelCompilationResults result , String package,
605+ void _writePackage (Component component , String package,
610606 List <Library > libraries, IOSink sink) {
611607 final canCache = libraries.isNotEmpty &&
612608 _compilerOptions.bytecode &&
@@ -621,7 +617,7 @@ class FrontendCompiler implements CompilerInterface {
621617 }
622618 }
623619
624- Component partComponent = result. component;
620+ Component partComponent = component;
625621 if (_compilerOptions.bytecode && errors.isEmpty) {
626622 generateBytecode (partComponent,
627623 options: _bytecodeOptions,
@@ -655,22 +651,17 @@ class FrontendCompiler implements CompilerInterface {
655651 _mainSource = _getFileOrUri (entryPoint);
656652 }
657653 errors.clear ();
658-
659654 Component deltaProgram = await _generator.compile (entryPoint: _mainSource);
655+
660656 if (deltaProgram != null && transformer != null ) {
661657 transformer.transform (deltaProgram);
662658 }
659+ final compiledSources = deltaProgram.uriToSource.keys;
663660
664- KernelCompilationResults results = new KernelCompilationResults (
665- deltaProgram,
666- _generator.getClassHierarchy (),
667- _generator.getCoreTypes (),
668- deltaProgram.uriToSource.keys);
669-
670- await writeDillFile (results, _kernelBinaryFilename);
661+ await writeDillFile (deltaProgram, _kernelBinaryFilename);
671662
672663 _outputStream.writeln (boundaryKey);
673- await _outputDependenciesDelta (results. compiledSources);
664+ await _outputDependenciesDelta (compiledSources);
674665 _outputStream
675666 .writeln ('$boundaryKey $_kernelBinaryFilename ${errors .length }' );
676667 _kernelBinaryFilename = _kernelBinaryFilenameIncremental;
0 commit comments