[ddc] Removing some references to "legacy" DDC modules.

"DDC" is now the accepted name for the module system.

Change-Id: I655219ccc7cff7ff99b1311518ef6ed6e7d1b2a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348085
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
MarkZ 2024-01-24 21:22:25 +00:00 committed by Commit Queue
parent 728e8fdd0c
commit 8edbcacfb0
7 changed files with 11 additions and 13 deletions

View file

@ -82,7 +82,6 @@ void addModuleFormatOptions(ArgParser argParser, {bool hide = true}) {
Program transformModuleFormat(ModuleFormat format, Program module) { Program transformModuleFormat(ModuleFormat format, Program module) {
switch (format) { switch (format) {
case ModuleFormat.ddc: case ModuleFormat.ddc:
// Legacy format always generates output compatible with single file mode.
return DdcModuleBuilder().build(module); return DdcModuleBuilder().build(module);
case ModuleFormat.common: case ModuleFormat.common:
return CommonJSModuleBuilder().build(module); return CommonJSModuleBuilder().build(module);
@ -108,7 +107,6 @@ Fun transformFunctionModuleFormat(
List<ModuleItem> items, Fun function, ModuleFormat format) { List<ModuleItem> items, Fun function, ModuleFormat format) {
switch (format) { switch (format) {
case ModuleFormat.ddc: case ModuleFormat.ddc:
// Legacy format always generates output compatible with single file mode.
return DdcModuleBuilder().buildFunctionWithImports(items, function); return DdcModuleBuilder().buildFunctionWithImports(items, function);
case ModuleFormat.amd: case ModuleFormat.amd:
return AmdModuleBuilder().buildFunctionWithImports(items, function); return AmdModuleBuilder().buildFunctionWithImports(items, function);

View file

@ -304,7 +304,7 @@ Map<String, String> _parseCustomSummaryModules(List<String> summaryPaths,
modulePath = summaryPath.substring(equalSign + 1); modulePath = summaryPath.substring(equalSign + 1);
summaryPath = summaryPath.substring(0, equalSign); summaryPath = summaryPath.substring(0, equalSign);
} else if (moduleRoot != null && p.isWithin(moduleRoot, summaryPath)) { } else if (moduleRoot != null && p.isWithin(moduleRoot, summaryPath)) {
// TODO(jmesserly): remove this, it's legacy --module-root support. // TODO: Determine if this logic is still needed.
modulePath = p.url.joinAll( modulePath = p.url.joinAll(
p.split(p.relative(summaryPathWithoutExt, from: moduleRoot))); p.split(p.relative(summaryPathWithoutExt, from: moduleRoot)));
} else { } else {

View file

@ -144,10 +144,10 @@ void main() {
expect(outputJsFile.existsSync(), isTrue); expect(outputJsFile.existsSync(), isTrue);
}); });
test('can compile in basic mode with "legacy" modules', () async { test('can compile in basic mode with DDC modules', () async {
var args = List<String>.from(executableArgs) var args = List<String>.from(executableArgs)
..add('--modules') ..add('--modules')
..add('legacy') ..add('ddc')
..addAll(compilerArgs); ..addAll(compilerArgs);
var result = Process.runSync(Platform.executable, args); var result = Process.runSync(Platform.executable, args);

View file

@ -219,7 +219,7 @@ void main(List<String> args) async {
break; break;
case 'd8': case 'd8':
d8 = true; d8 = true;
mod = 'legacy'; mod = 'ddc';
break; break;
case 'chrome': case 'chrome':
chrome = true; chrome = true;

View file

@ -698,14 +698,14 @@ class DevCompilerConfiguration extends CompilerConfiguration {
args.addAll([ args.addAll([
"--ignore-unrecognized-flags", "--ignore-unrecognized-flags",
"--no-summarize", "--no-summarize",
if (d8Runtime) "--modules=legacy", if (d8Runtime) "--modules=ddc",
"-o", "-o",
outputFile, outputFile,
inputFile, inputFile,
]); ]);
if (!d8Runtime) { if (!d8Runtime) {
// TODO(sigmund): allow caching of shared packages in legacy mode too. // TODO(sigmund): allow caching of shared packages for DDC modules too.
// Link to the summaries for the available packages, so that they don't // Link to the summaries for the available packages, so that they don't
// get recompiled into the test's own module. // get recompiled into the test's own module.
for (var package in testPackages) { for (var package in testPackages) {

View file

@ -57,7 +57,7 @@ List get devtoolsFormatters => _devtoolsFormatters;
@JS('JSON.stringify') @JS('JSON.stringify')
external stringify(value, [Function replacer, int space]); external stringify(value, [Function replacer, int space]);
// TODO(jacobr): this is only valid if the legacy library loader is used. // TODO(jacobr): this is only valid if the DDC library loader is used.
// We need a solution that works with all library loaders. // We need a solution that works with all library loaders.
@JS('dart_library.import') @JS('dart_library.import')
external importDartLibrary(String path); external importDartLibrary(String path);

View file

@ -440,8 +440,8 @@ template("ddc_compile_sdk") {
"$js_gen_dir/common/dart_sdk.js.map", "$js_gen_dir/common/dart_sdk.js.map",
"$js_gen_dir/es6/dart_sdk.js", "$js_gen_dir/es6/dart_sdk.js",
"$js_gen_dir/es6/dart_sdk.js.map", "$js_gen_dir/es6/dart_sdk.js.map",
"$js_gen_dir/legacy/dart_sdk.js", "$js_gen_dir/ddc/dart_sdk.js",
"$js_gen_dir/legacy/dart_sdk.js.map", "$js_gen_dir/ddc/dart_sdk.js.map",
] ]
vm_args = [ "-Dsdk_hash=$sdk_hash" ] vm_args = [ "-Dsdk_hash=$sdk_hash" ]
@ -473,9 +473,9 @@ template("ddc_compile_sdk") {
"-o", "-o",
rebase_path("$js_gen_dir/es6/dart_sdk.js"), rebase_path("$js_gen_dir/es6/dart_sdk.js"),
"--modules", "--modules",
"legacy", "ddc",
"-o", "-o",
rebase_path("$js_gen_dir/legacy/dart_sdk.js"), rebase_path("$js_gen_dir/ddc/dart_sdk.js"),
rebase_path("$platform_input"), rebase_path("$platform_input"),
] ]