[ddc] Cleanup use of dart library name

Avoid hard coded uses of the name for the SDK runtime library. This
unblocks a more consistent name/rename logic for all dart libraries
when they are imported.

Change-Id: I4599006569ecae81a0526686467e06da9b335fc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385188
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Nicholas Shahan
2024-09-25 21:49:39 +00:00
committed by Commit Queue
parent c2b99d21c1
commit 39bcea7e76
8 changed files with 36 additions and 23 deletions
+11 -6
View File
@@ -6135,13 +6135,18 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
var typeArgs = node.arguments.types;
var name = target.name.text;
if (args.isEmpty && typeArgs.length == 1) {
if (name == 'TYPE_REF') {
return _emitType(typeArgs.single);
if (args.isEmpty) {
if (typeArgs.isEmpty && name == 'DART_RUNTIME_LIBRARY') {
return _runtimeModule;
}
if (name == 'LEGACY_TYPE_REF') {
return _emitType(
typeArgs.single.withDeclaredNullability(Nullability.legacy));
if (typeArgs.length == 1) {
if (name == 'TYPE_REF') {
return _emitType(typeArgs.single);
}
if (name == 'LEGACY_TYPE_REF') {
return _emitType(
typeArgs.single.withDeclaredNullability(Nullability.legacy));
}
}
}
@@ -6215,16 +6215,20 @@ class LibraryCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
var typeArgs = node.arguments.types;
var name = target.name.text;
if (args.isEmpty && typeArgs.length == 1) {
if (name == 'TYPE_REF') {
return _emitType(typeArgs.single);
if (args.isEmpty) {
if (typeArgs.isEmpty && name == 'DART_RUNTIME_LIBRARY') {
return _runtimeModule;
}
if (name == 'LEGACY_TYPE_REF') {
return _emitType(
typeArgs.single.withDeclaredNullability(Nullability.legacy));
if (typeArgs.length == 1) {
if (name == 'TYPE_REF') {
return _emitType(typeArgs.single);
}
if (name == 'LEGACY_TYPE_REF') {
return _emitType(
typeArgs.single.withDeclaredNullability(Nullability.legacy));
}
}
}
if (args.length == 1) {
if (name == 'getInterceptor') {
var argExpression = args.single.accept(this);