mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:19:49 +00:00
Pass offset to buildSupertype
Change-Id: I4a1cf524e7edbb9bc8d435fbea8a6b4eb440a077 Reviewed-on: https://dart-review.googlesource.com/28302 Reviewed-by: Aske Simon Christensen <askesc@google.com>
This commit is contained in:
parent
08aa7e9114
commit
c9026e446e
|
@ -72,9 +72,8 @@ class KernelFunctionTypeBuilder extends FunctionTypeBuilder
|
|||
positionalParameterNames: positionalParameterNames);
|
||||
}
|
||||
|
||||
Supertype buildSupertype(LibraryBuilder library) {
|
||||
int charOffset = -1; // TODO(ahe): Provide these.
|
||||
Uri fileUri = null; // TODO(ahe): Provide these.
|
||||
Supertype buildSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
library.addCompileTimeError(
|
||||
messageSupertypeIsFunction, charOffset, fileUri);
|
||||
return null;
|
||||
|
|
|
@ -34,9 +34,8 @@ class KernelMixinApplicationBuilder
|
|||
}
|
||||
|
||||
@override
|
||||
Supertype buildSupertype(LibraryBuilder library) {
|
||||
int charOffset = -1; // TODO(ahe): Provide these.
|
||||
Uri fileUri = null; // TODO(ahe): Provide these.
|
||||
Supertype buildSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
return unsupported("buildSupertype", charOffset, fileUri);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,8 @@ class KernelNamedTypeBuilder
|
|||
return new KernelInvalidTypeBuilder("$name", charOffset, fileUri);
|
||||
}
|
||||
|
||||
Supertype handleInvalidSupertype(LibraryBuilder library) {
|
||||
int charOffset = -1; // TODO(ahe): Provide these.
|
||||
Uri fileUri = null; // TODO(ahe): Provide these.
|
||||
Supertype handleInvalidSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
var template = builder.isTypeVariable
|
||||
? templateSupertypeIsTypeVariable
|
||||
: templateSupertypeIsIllegal;
|
||||
|
@ -46,12 +45,13 @@ class KernelNamedTypeBuilder
|
|||
return builder.buildType(library, arguments);
|
||||
}
|
||||
|
||||
Supertype buildSupertype(LibraryBuilder library) {
|
||||
Supertype buildSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
if (builder is KernelClassBuilder) {
|
||||
KernelClassBuilder builder = this.builder;
|
||||
return builder.buildSupertype(library, arguments);
|
||||
} else {
|
||||
return handleInvalidSupertype(library);
|
||||
return handleInvalidSupertype(library, charOffset, fileUri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -389,7 +389,8 @@ class KernelTarget extends TargetImplementation {
|
|||
..bind(objectClassBuilder);
|
||||
}
|
||||
if (builder.isMixinApplication) {
|
||||
cls.mixedInType = builder.mixedInType.buildSupertype(library);
|
||||
cls.mixedInType = builder.mixedInType
|
||||
.buildSupertype(library, builder.charOffset, builder.fileUri);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,5 +13,5 @@ abstract class KernelTypeBuilder extends TypeBuilder {
|
|||
|
||||
DartType build(LibraryBuilder library);
|
||||
|
||||
Supertype buildSupertype(LibraryBuilder library);
|
||||
Supertype buildSupertype(LibraryBuilder library, int charOffset, Uri fileUri);
|
||||
}
|
||||
|
|
|
@ -128,14 +128,17 @@ class SourceClassBuilder extends KernelClassBuilder {
|
|||
|
||||
scope.forEach(buildBuilders);
|
||||
constructors.forEach(buildBuilders);
|
||||
actualCls.supertype = supertype?.buildSupertype(library);
|
||||
actualCls.mixedInType = mixedInType?.buildSupertype(library);
|
||||
actualCls.supertype =
|
||||
supertype?.buildSupertype(library, charOffset, fileUri);
|
||||
actualCls.mixedInType =
|
||||
mixedInType?.buildSupertype(library, charOffset, fileUri);
|
||||
// TODO(ahe): If `cls.supertype` is null, and this isn't Object, report a
|
||||
// compile-time error.
|
||||
cls.isAbstract = isAbstract;
|
||||
if (interfaces != null) {
|
||||
for (KernelTypeBuilder interface in interfaces) {
|
||||
Supertype supertype = interface.buildSupertype(library);
|
||||
Supertype supertype =
|
||||
interface.buildSupertype(library, charOffset, fileUri);
|
||||
if (supertype != null) {
|
||||
// TODO(ahe): Report an error if supertype is null.
|
||||
actualCls.implementedTypes.add(supertype);
|
||||
|
|
|
@ -644,8 +644,6 @@ class SourceLoader<L> extends Loader<L> {
|
|||
message.code == fasta_codes.codeConstConstructorWithBody ||
|
||||
message.code == fasta_codes.codeConstructorNotFound ||
|
||||
message.code == fasta_codes.codeSuperclassHasNoDefaultConstructor ||
|
||||
message.code == fasta_codes.codeSupertypeIsIllegal ||
|
||||
message.code == fasta_codes.codeSupertypeIsTypeVariable ||
|
||||
message.code == fasta_codes.codeTypeArgumentsOnTypeVariable ||
|
||||
message.code == fasta_codes.codeTypeNotFound ||
|
||||
message.code == fasta_codes.codeUnspecified)) {
|
||||
|
|
|
@ -25,7 +25,7 @@ class C<T extends core::Object> extends core::Object { // from org-dartlang-test
|
|||
static factory b<T extends core::Object>() → self::C<self::C::b::T>
|
||||
let dynamic #redirecting_factory = lib::C::b in invalid-expression;
|
||||
}
|
||||
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart: Error: The type 'lib.Missing' can't be used as supertype."]/* from null */;
|
||||
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.\nclass Bad extends lib.Missing {\n ^"]/* from null */;
|
||||
static method main() → dynamic {
|
||||
new self::C::•<core::String>();
|
||||
new self::C::a<core::String>();
|
||||
|
|
|
@ -25,7 +25,7 @@ class C<T extends core::Object> extends core::Object { // from org-dartlang-test
|
|||
static factory b<T extends core::Object>() → self::C<self::C::b::T>
|
||||
let dynamic #redirecting_factory = lib::C::b in invalid-expression;
|
||||
}
|
||||
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart: Error: The type 'lib.Missing' can't be used as supertype."]/* from null */;
|
||||
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.\nclass Bad extends lib.Missing {\n ^"]/* from null */;
|
||||
static method main() → dynamic {
|
||||
new self::C::•<core::String>();
|
||||
new self::C::a<core::String>();
|
||||
|
|
Loading…
Reference in a new issue