| Index: pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
|
| index 3cc30e0f14dd9e97b896ce8b997e1a20392f3add..018e27b33a8aa152df211d152a628a348d7e6ff3 100644
|
| --- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
|
| +++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
|
| @@ -50,7 +50,15 @@ abstract class BuilderHelper {
|
|
|
| Expression buildCompileTimeError(error, [int offset]);
|
|
|
| - Initializer buildCompileTimeErrorIntializer(error, [int offset]);
|
| + Initializer buildInvalidIntializer(Expression expression, [int offset]);
|
| +
|
| + Initializer buildSuperInitializer(
|
| + Constructor constructor, Arguments arguments,
|
| + [int offset]);
|
| +
|
| + Initializer buildRedirectingInitializer(
|
| + Constructor constructor, Arguments arguments,
|
| + [int charOffset = -1]);
|
|
|
| Expression buildStaticInvocation(Procedure target, Arguments arguments);
|
|
|
| @@ -59,6 +67,9 @@ abstract class BuilderHelper {
|
| Expression throwNoSuchMethodError(
|
| String name, Arguments arguments, int offset,
|
| {bool isSuper: false, isGetter: false, isSetter: false});
|
| +
|
| + bool checkArguments(FunctionNode function, Arguments arguments,
|
| + List<TypeParameter> typeParameters);
|
| }
|
|
|
| abstract class FastaAccessor implements Accessor {
|
| @@ -70,13 +81,18 @@ abstract class FastaAccessor implements Accessor {
|
|
|
| String get plainNameForWrite => plainNameForRead;
|
|
|
| + bool get isInitializer => false;
|
| +
|
| Expression buildForEffect() => buildSimpleRead();
|
|
|
| Initializer buildFieldInitializer(
|
| Map<String, FieldInitializer> initializers) {
|
| - // TODO(ahe): This error message is really bad.
|
| - return helper.buildCompileTimeErrorIntializer(
|
| - "Can't use $plainNameForRead here.", offset);
|
| + return helper.buildInvalidIntializer(
|
| + helper.buildCompileTimeError(
|
| + // TODO(ahe): This error message is really bad.
|
| + "Can't use $plainNameForRead here.",
|
| + offset),
|
| + offset);
|
| }
|
|
|
| Expression makeInvalidRead() {
|
| @@ -151,8 +167,8 @@ abstract class ErrorAccessor implements FastaAccessor {
|
| @override
|
| Initializer buildFieldInitializer(
|
| Map<String, FieldInitializer> initializers) {
|
| - return new LocalInitializer(new VariableDeclaration.forValue(
|
| - buildError(new Arguments.empty(), isSetter: true)));
|
| + return helper.buildInvalidIntializer(
|
| + buildError(new Arguments.empty(), isSetter: true));
|
| }
|
|
|
| @override
|
| @@ -266,8 +282,10 @@ class ThisAccessor extends FastaAccessor {
|
| Initializer buildFieldInitializer(
|
| Map<String, FieldInitializer> initializers) {
|
| String keyword = isSuper ? "super" : "this";
|
| - return helper.buildCompileTimeErrorIntializer(
|
| - "Can't use '$keyword' here, did you mean '$keyword()'?", offset);
|
| + return helper.buildInvalidIntializer(
|
| + helper.buildCompileTimeError(
|
| + "Can't use '$keyword' here, did you mean '$keyword()'?", offset),
|
| + offset);
|
| }
|
|
|
| buildPropertyAccess(IncompleteSend send, bool isNullAware) {
|
| @@ -306,17 +324,18 @@ class ThisAccessor extends FastaAccessor {
|
| Initializer buildConstructorInitializer(
|
| int offset, Name name, Arguments arguments) {
|
| Constructor constructor = helper.lookupConstructor(name, isSuper: isSuper);
|
| - Initializer result;
|
| - if (constructor == null) {
|
| - result = new LocalInitializer(new VariableDeclaration.forValue(
|
| + if (constructor == null ||
|
| + !helper.checkArguments(
|
| + constructor.function, arguments, <TypeParameter>[])) {
|
| + return helper.buildInvalidIntializer(
|
| buildThrowNoSuchMethodError(arguments,
|
| - isSuper: isSuper, name: name.name, offset: offset)));
|
| + isSuper: isSuper, name: name.name, offset: offset),
|
| + offset);
|
| } else if (isSuper) {
|
| - result = new SuperInitializer(constructor, arguments);
|
| + return helper.buildSuperInitializer(constructor, arguments, offset);
|
| } else {
|
| - result = new RedirectingInitializer(constructor, arguments);
|
| + return helper.buildRedirectingInitializer(constructor, arguments, offset);
|
| }
|
| - return result..fileOffset = offset;
|
| }
|
|
|
| Expression buildAssignment(Expression value, {bool voidContext: false}) {
|
|
|