Skip to content

Commit a7e4d59

Browse files
srujzsCommit Queue
authored andcommitted
[ddc] Fix passing module format to ExpressionCompiler
The DDC library bundle format is a combination of the DDC format and canary, so therefore check that's the case, and if so, pass the library bundle format. Change-Id: I067d2b020e75b703a30fbe7d5f8dc2d31cd4878c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396420 Reviewed-by: Nicholas Shahan <[email protected]> Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Srujan Gaddam <[email protected]>
1 parent 294a50f commit a7e4d59

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,9 @@ class ExpressionCompilerWorker {
504504

505505
expressionCompiler = ExpressionCompiler(
506506
_compilerOptions,
507-
_moduleFormat,
507+
_moduleFormat == ModuleFormat.ddc && _canaryFeatures
508+
? ModuleFormat.ddcLibraryBundle
509+
: _moduleFormat,
508510
errors,
509511
incrementalCompiler,
510512
kernel2jsCompiler,

pkg/frontend_server/lib/frontend_server.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ import 'dart:typed_data' show BytesBuilder;
1818

1919
import 'package:args/args.dart';
2020
import 'package:dev_compiler/dev_compiler.dart'
21-
show Compiler, DevCompilerTarget, ExpressionCompiler, parseModuleFormat;
21+
show
22+
Compiler,
23+
DevCompilerTarget,
24+
ExpressionCompiler,
25+
ModuleFormat,
26+
parseModuleFormat;
2227
import 'package:front_end/src/api_prototype/macros.dart' as macros
2328
show isMacroLibraryUri;
2429
import 'package:front_end/src/api_unstable/ddc.dart' as ddc
@@ -1139,9 +1144,16 @@ class FrontendCompiler implements CompilerInterface {
11391144

11401145
_processedOptions.ticker.logMs('Computed component');
11411146

1147+
ModuleFormat moduleFormat =
1148+
parseModuleFormat(_options['dartdevc-module-format'] as String);
1149+
final bool canaryFeatures = _options['dartdevc-canary'] as bool;
1150+
if (moduleFormat == ModuleFormat.ddc && canaryFeatures) {
1151+
moduleFormat = ModuleFormat.ddcLibraryBundle;
1152+
}
1153+
11421154
final ExpressionCompiler expressionCompiler = new ExpressionCompiler(
11431155
_compilerOptions,
1144-
parseModuleFormat(_options['dartdevc-module-format'] as String),
1156+
moduleFormat,
11451157
errors,
11461158
_generator.generator as ddc.IncrementalCompiler,
11471159
kernel2jsCompiler,

0 commit comments

Comments
 (0)