mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 13:08:01 +00:00
[ddc] Fix default type args signature on native classes
- They should match the calling convention and use the "dartx" symbol. - Skip adding signatures for static methods since they can't be called dynamically anyway. Issue: https://github.com/dart-lang/sdk/issues/48585 Issue: https://github.com/dart-lang/sdk/issues/52867 Change-Id: If5a76f52163b2267129880dbfe8d145a3fd93408 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312204 Reviewed-by: Mark Zhou <markzipan@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
e62748f3e1
commit
5ca83258ef
|
@ -1730,6 +1730,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
} else {
|
||||
type = visitFunctionType(reifiedType);
|
||||
if (_options.newRuntimeTypes &&
|
||||
!member.isStatic &&
|
||||
reifiedType.typeParameters.isNotEmpty) {
|
||||
// Instance methods with generic type parameters require extra
|
||||
// information to support dynamic calls. The default values for the
|
||||
|
@ -1739,8 +1740,18 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
for (var parameter in reifiedType.typeParameters)
|
||||
_emitType(parameter.defaultType)
|
||||
]);
|
||||
var property = js_ast.Property(memberName, defaultTypeArgs);
|
||||
instanceMethodsDefaultTypeArgs.add(property);
|
||||
instanceMethodsDefaultTypeArgs
|
||||
.add(js_ast.Property(memberName, defaultTypeArgs));
|
||||
// As seen below, sometimes the member signatures are added again
|
||||
// using the extension symbol as the name. That logic is duplicated
|
||||
// here to ensure there are always default type arguments accessible
|
||||
// via the same name as the signature.
|
||||
// TODO(52867): Cleanup default type argument duplication.
|
||||
if (extMethods.contains(name) || extAccessors.contains(name)) {
|
||||
instanceMethodsDefaultTypeArgs.add(js_ast.Property(
|
||||
_declareMemberName(member, useExtension: true),
|
||||
defaultTypeArgs));
|
||||
}
|
||||
}
|
||||
}
|
||||
var property = js_ast.Property(memberName, type);
|
||||
|
@ -1748,6 +1759,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
signatures.add(property);
|
||||
if (!member.isStatic &&
|
||||
(extMethods.contains(name) || extAccessors.contains(name))) {
|
||||
// TODO(52867): Cleanup signature duplication.
|
||||
signatures.add(js_ast.Property(
|
||||
_declareMemberName(member, useExtension: true), type));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue