| Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
|
| index 0d3e47a6abce7f195ba8c7d91dd5440ba8422a2c..aabc5e90c75a6b8187feb9fcdbbc40d7ba9599f4 100644
|
| --- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
|
| +++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
|
| @@ -48,7 +48,11 @@ import '../../scanner/token.dart' show BeginToken, Token;
|
|
|
| import '../scanner/token.dart' show isBinaryOperator, isMinusOperator;
|
|
|
| -import '../errors.dart' show InputError, formatUnexpected, internalError;
|
| +import '../deprecated_problems.dart'
|
| + show
|
| + deprecated_InputError,
|
| + deprecated_formatUnexpected,
|
| + deprecated_internalProblem;
|
|
|
| import '../source/scope_listener.dart'
|
| show JumpTargetKind, NullValue, ScopeListener;
|
| @@ -225,11 +229,12 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| } else if (node is Expression) {
|
| return node;
|
| } else if (node is PrefixBuilder) {
|
| - return buildCompileTimeError("A library can't be used as an expression.");
|
| + return deprecated_buildCompileTimeError(
|
| + "A library can't be used as an expression.");
|
| } else if (node is ProblemBuilder) {
|
| return buildProblemExpression(node, -1);
|
| } else {
|
| - return internalError("Unhandled: ${node.runtimeType}");
|
| + return deprecated_internalProblem("Unhandled: ${node.runtimeType}");
|
| }
|
| }
|
|
|
| @@ -305,7 +310,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| switchScope.unclaimedForwardDeclarations
|
| .forEach((String name, Builder builder) {
|
| if (outerSwitchScope == null) {
|
| - addCompileTimeError(-1, "Label not found: '$name'.");
|
| + deprecated_addCompileTimeError(-1, "Label not found: '$name'.");
|
| } else {
|
| outerSwitchScope.forwardDeclareLabel(name, builder);
|
| }
|
| @@ -323,11 +328,11 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| // This reports an error for duplicated declarations in the same scope:
|
| // `{ var x; var x; }`
|
| discardedStatement = pop(); // TODO(ahe): Issue 29717.
|
| - push(buildCompileTimeErrorStatement(
|
| + push(deprecated_buildCompileTimeErrorStatement(
|
| "'$name' already declared in this scope.", offset));
|
| return;
|
| }
|
| - InputError error = scope.declare(
|
| + deprecated_InputError error = scope.declare(
|
| variable.name,
|
| new KernelVariableBuilder(
|
| variable, member ?? classBuilder ?? library, uri),
|
| @@ -341,12 +346,12 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| discardedStatement = pop(); // TODO(ahe): Issue 29717.
|
|
|
| // Reports the error on the last declaration of `x`.
|
| - push(buildCompileTimeErrorStatement(
|
| + push(deprecated_buildCompileTimeErrorStatement(
|
| "Can't declare '$name' because it was already used in this scope.",
|
| offset));
|
|
|
| // Reports the error on `print(x)`.
|
| - library.addCompileTimeError(error.charOffset, error.error,
|
| + library.deprecated_addCompileTimeError(error.charOffset, error.error,
|
| fileUri: error.uri);
|
| }
|
| }
|
| @@ -393,7 +398,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
|
|
| bool savedConstantExpressionRequired = pop();
|
| if (expression is! StaticAccessor) {
|
| - push(wrapInCompileTimeError(
|
| + push(deprecated_wrapInCompileTimeError(
|
| toValue(expression),
|
| "This can't be used as metadata; metadata should be a reference to "
|
| "a compile-time constant variable, or "
|
| @@ -440,7 +445,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (field.next != null) {
|
| // TODO(ahe): This can happen, for example, if a final field is
|
| // combined with a setter.
|
| - internalError(
|
| + deprecated_internalProblem(
|
| "Unhandled: '${field.name}' has more than one declaration.");
|
| }
|
| field.initializer = initializer;
|
| @@ -492,7 +497,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (member is KernelConstructorBuilder) {
|
| if (member.isConst &&
|
| (classBuilder.cls.superclass?.isMixinApplication ?? false)) {
|
| - addCompileTimeError(member.charOffset,
|
| + deprecated_addCompileTimeError(member.charOffset,
|
| "Can't extend a mixin application and be 'const'.");
|
| }
|
| if (member.formals != null) {
|
| @@ -501,7 +506,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| Initializer initializer;
|
| if (member.isExternal) {
|
| initializer = buildInvalidInitializer(
|
| - buildCompileTimeError(
|
| + deprecated_buildCompileTimeError(
|
| "An external constructor can't initialize fields.",
|
| formal.charOffset),
|
| formal.charOffset);
|
| @@ -564,7 +569,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| } else {
|
| Expression value = toValue(node);
|
| if (node is! Throw) {
|
| - value = wrapInCompileTimeError(value, "Expected an initializer.");
|
| + value = deprecated_wrapInCompileTimeError(
|
| + value, "Expected an initializer.");
|
| }
|
| initializer = buildInvalidInitializer(node, token.charOffset);
|
| }
|
| @@ -572,7 +578,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (member is KernelConstructorBuilder && !member.isExternal) {
|
| member.addInitializer(initializer);
|
| } else {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| token.charOffset, "Can't have initializers: ${member.name}");
|
| }
|
| }
|
| @@ -619,7 +625,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| } else if (builder is KernelProcedureBuilder) {
|
| builder.asyncModifier = asyncModifier;
|
| } else {
|
| - internalError("Unhandled: ${builder.runtimeType}");
|
| + deprecated_internalProblem("Unhandled: ${builder.runtimeType}");
|
| }
|
| }
|
|
|
| @@ -641,7 +647,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| // TODO(ahe): Change this to a null check.
|
| int offset = builder.body?.fileOffset ?? builder.charOffset;
|
| constructor.initializers.add(buildInvalidInitializer(
|
| - buildCompileTimeError(
|
| + deprecated_buildCompileTimeError(
|
| "A constructor can't be '${asyncModifier}'.", offset),
|
| offset));
|
| }
|
| @@ -660,7 +666,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| ? "'$superclass' doesn't have an unnamed constructor."
|
| : "The unnamed constructor in '$superclass' requires arguments.";
|
| initializer = buildInvalidInitializer(
|
| - buildCompileTimeError(message, builder.charOffset),
|
| + deprecated_buildCompileTimeError(message, builder.charOffset),
|
| builder.charOffset);
|
| } else {
|
| initializer =
|
| @@ -699,7 +705,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (i > firstNamedArgumentIndex) {
|
| arguments[i] = new NamedExpression(
|
| "#$i",
|
| - buildCompileTimeError(
|
| + deprecated_buildCompileTimeError(
|
| "Expected named argument.", arguments[i].fileOffset))
|
| ..fileOffset = beginToken.charOffset;
|
| }
|
| @@ -715,7 +721,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| named = <NamedExpression>[
|
| new NamedExpression(
|
| named[1].name,
|
| - buildCompileTimeError(
|
| + deprecated_buildCompileTimeError(
|
| "Duplicated named argument '${named[1].name}'.",
|
| named[1].fileOffset))
|
| ];
|
| @@ -726,7 +732,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| for (NamedExpression expression in named) {
|
| if (seenNames.containsKey(expression.name)) {
|
| hasProblem = true;
|
| - seenNames[expression.name].value = buildCompileTimeError(
|
| + seenNames[expression.name].value = deprecated_buildCompileTimeError(
|
| "Duplicated named argument '${expression.name}'.",
|
| expression.fileOffset);
|
| } else {
|
| @@ -859,7 +865,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| negate = true;
|
| }
|
| if (!isBinaryOperator(operator) && !isMinusOperator(operator)) {
|
| - return buildCompileTimeError(
|
| + return deprecated_buildCompileTimeError(
|
| "Not an operator: '$operator'.", token.charOffset);
|
| } else {
|
| Expression result =
|
| @@ -912,7 +918,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| warnUnresolvedSuperMethod(node.name, node.fileOffset);
|
| } else if (!areArgumentsCompatible(target.function, node.arguments)) {
|
| target = null;
|
| - warning(
|
| + deprecated_warning(
|
| "Super class doesn't have a method named '${node.name.name}' "
|
| "with matching arguments.",
|
| node.fileOffset);
|
| @@ -968,7 +974,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| // TODO(ahe): Use error below instead of building a compile-time error,
|
| // should be:
|
| // return library.loader.throwCompileConstantError(error, charOffset);
|
| - return buildCompileTimeError(message, charOffset);
|
| + return deprecated_buildCompileTimeError(message, charOffset);
|
| } else {
|
| Expression error = library.loader.instantiateNoSuchMethodError(
|
| receiver, name, arguments, charOffset,
|
| @@ -977,24 +983,27 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| isSetter: isSetter,
|
| isStatic: isStatic,
|
| isTopLevel: !isStatic && !isSuper);
|
| - warning(message, charOffset);
|
| + deprecated_warning(message, charOffset);
|
| return new KernelSyntheticExpression(new Throw(error));
|
| }
|
| }
|
|
|
| @override
|
| void warnUnresolvedSuperGet(Name name, int charOffset) {
|
| - warning("Super class has no getter named '${name.name}'.", charOffset);
|
| + deprecated_warning(
|
| + "Super class has no getter named '${name.name}'.", charOffset);
|
| }
|
|
|
| @override
|
| void warnUnresolvedSuperSet(Name name, int charOffset) {
|
| - warning("Super class has no setter named '${name.name}'.", charOffset);
|
| + deprecated_warning(
|
| + "Super class has no setter named '${name.name}'.", charOffset);
|
| }
|
|
|
| @override
|
| void warnUnresolvedSuperMethod(Name name, int charOffset) {
|
| - warning("Super class has no method named '${name.name}'.", charOffset);
|
| + deprecated_warning(
|
| + "Super class has no method named '${name.name}'.", charOffset);
|
| }
|
|
|
| @override
|
| @@ -1041,7 +1050,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| }
|
| } else if (constantExpressionRequired &&
|
| !context.allowedInConstantExpression) {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| token.charOffset, "Not a constant expression: $context");
|
| }
|
| push(new Identifier(token));
|
| @@ -1057,7 +1066,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| {bool isQualified: false, PrefixBuilder prefix}) {
|
| Builder builder = scope.lookup(name, offsetForToken(token), uri);
|
| if (builder != null && member.isField && builder.isInstanceMember) {
|
| - return new IncompleteError(this, token,
|
| + return new deprecated_IncompleteError(this, token,
|
| "Can't access 'this' in a field initializer to read '$name'.");
|
| }
|
| if (builder == null || (!isInstanceContext && builder.isInstanceMember)) {
|
| @@ -1073,8 +1082,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| // eagerly by kernel-service, thus preventing any attempts from running
|
| // a program that uses deferred loading. Obviously, this is a temporary
|
| // solution until we can fully implement deferred loading.
|
| - addCompileTimeError(offset, message, wasHandled: false, silent: true);
|
| - return buildCompileTimeError(message, offset);
|
| + deprecated_addCompileTimeError(offset, message,
|
| + wasHandled: false, silent: true);
|
| + return deprecated_buildCompileTimeError(message, offset);
|
| } else if (!isQualified && isInstanceContext) {
|
| assert(builder == null);
|
| if (constantExpressionRequired || member.isField) {
|
| @@ -1092,7 +1102,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (constantExpressionRequired &&
|
| builder.isTypeVariable &&
|
| !member.isConstructor) {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| offsetForToken(token), "Not a constant expression.");
|
| }
|
| return new TypeDeclarationAccessor(this, builder, name, token);
|
| @@ -1100,7 +1110,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (constantExpressionRequired &&
|
| !builder.isConst &&
|
| !member.isConstructor) {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| offsetForToken(token), "Not a constant expression.");
|
| }
|
| // An initializing formal parameter might be final without its
|
| @@ -1128,7 +1138,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| // semantics, such parameters introduces a new parameter with that
|
| // name that should be resolved here.
|
| !member.isConstructor) {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| offsetForToken(token), "Not a constant expression.");
|
| }
|
| return new ThisPropertyAccessor(
|
| @@ -1138,7 +1148,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| return new StaticAccessor(this, token, builder.target, null);
|
| } else if (builder is PrefixBuilder) {
|
| if (constantExpressionRequired && builder.deferred) {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| offsetForToken(token),
|
| "'$name' can't be used in a constant expression because it's "
|
| "marked as 'deferred' which means it isn't available until "
|
| @@ -1148,7 +1158,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| }
|
| return builder;
|
| } else {
|
| - if (builder.hasProblem && builder is! AccessErrorBuilder) return builder;
|
| + if (builder.hasProblem && builder is! deprecated_AccessErrorBuilder)
|
| + return builder;
|
| Builder setter;
|
| if (builder.isSetter) {
|
| setter = builder;
|
| @@ -1164,7 +1175,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (!(readTarget is Field && readTarget.isConst ||
|
| // Static tear-offs are also compile time constants.
|
| readTarget is Procedure)) {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| offsetForToken(token), "Not a constant expression.");
|
| }
|
| }
|
| @@ -1286,7 +1297,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| debugEvent("ReturnStatement");
|
| Expression expression = hasExpression ? popForValue() : null;
|
| if (expression != null && inConstructor) {
|
| - push(buildCompileTimeErrorStatement(
|
| + push(deprecated_buildCompileTimeErrorStatement(
|
| "Can't return from a constructor.", beginToken.charOffset));
|
| } else {
|
| push(new KernelReturnStatement(expression)
|
| @@ -1335,10 +1346,10 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| // silent if the next token is `in`. Since a for-in loop can only have
|
| // one variable it must be followed by `in`.
|
| if (isConst) {
|
| - initializer = buildCompileTimeError(
|
| + initializer = deprecated_buildCompileTimeError(
|
| "A 'const' variable must be initialized.", token.charOffset);
|
| } else if (isFinal) {
|
| - initializer = buildCompileTimeError(
|
| + initializer = deprecated_buildCompileTimeError(
|
| "A 'final' variable must be initialized.", token.charOffset);
|
| }
|
| }
|
| @@ -1430,7 +1441,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| Expression value = popForValue();
|
| var accessor = pop();
|
| if (accessor is! FastaAccessor) {
|
| - push(buildCompileTimeError("Can't assign to this.", token.charOffset));
|
| + push(deprecated_buildCompileTimeError(
|
| + "Can't assign to this.", token.charOffset));
|
| } else {
|
| push(new DelayedAssignment(
|
| this, token, accessor, value, token.stringValue));
|
| @@ -1488,7 +1500,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| } else if (variableOrExpression is Expression) {
|
| begin = new KernelExpressionStatement(variableOrExpression);
|
| } else {
|
| - return internalError("Unhandled: ${variableOrExpression.runtimeType}");
|
| + return deprecated_internalProblem(
|
| + "Unhandled: ${variableOrExpression.runtimeType}");
|
| }
|
| exitLocalScope();
|
| JumpTarget continueTarget = exitContinueTarget();
|
| @@ -1533,7 +1546,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| typeArgument = typeArguments.first;
|
| if (typeArguments.length > 1) {
|
| typeArgument = null;
|
| - warningNotError(
|
| + deprecated_warningNotError(
|
| "Too many type arguments on List literal.", beginToken.charOffset);
|
| }
|
| }
|
| @@ -1575,7 +1588,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (typeArguments.length != 2) {
|
| keyType = null;
|
| valueType = null;
|
| - warningNotError(
|
| + deprecated_warningNotError(
|
| "Map literal requires two type arguments.", beginToken.charOffset);
|
| } else {
|
| keyType = typeArguments[0];
|
| @@ -1601,7 +1614,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| } else if (name is Operator) {
|
| return name.name;
|
| } else {
|
| - return internalError("Unhandled: ${name.runtimeType}");
|
| + return deprecated_internalProblem("Unhandled: ${name.runtimeType}");
|
| }
|
| }
|
|
|
| @@ -1626,7 +1639,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| String name, List<DartType> arguments, int charOffset) {
|
| Builder builder = scope.lookup(name, charOffset, uri);
|
| if (builder == null) {
|
| - warning("Type not found: '$name'.", charOffset);
|
| + deprecated_warning("Type not found: '$name'.", charOffset);
|
| return const InvalidType();
|
| } else {
|
| return kernelTypeFromBuilder(builder, arguments, charOffset);
|
| @@ -1636,13 +1649,13 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| DartType kernelTypeFromBuilder(
|
| Builder builder, List<DartType> arguments, int charOffset) {
|
| if (constantExpressionRequired && builder is TypeVariableBuilder) {
|
| - addCompileTimeError(charOffset, "Not a constant expression.");
|
| + deprecated_addCompileTimeError(charOffset, "Not a constant expression.");
|
| }
|
| if (builder.hasProblem) {
|
| ProblemBuilder problem = builder;
|
| - addCompileTimeError(charOffset, problem.message);
|
| + deprecated_addCompileTimeError(charOffset, problem.deprecated_message);
|
| } else {
|
| - warningNotError(
|
| + deprecated_warningNotError(
|
| "Not a type: '${builder.fullNameForErrors}'.", charOffset);
|
| }
|
| // TODO(ahe): Create an error somehow.
|
| @@ -1657,7 +1670,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| dynamic name = pop();
|
| if (name is List) {
|
| if (name.length != 2) {
|
| - internalError("Unexpected: $name.length");
|
| + deprecated_internalProblem("Unexpected: $name.length");
|
| }
|
| var prefix = name[0];
|
| if (prefix is Identifier) {
|
| @@ -1678,7 +1691,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| isQualified: true, prefix: builder);
|
| } else {
|
| push(const InvalidType());
|
| - addCompileTimeError(beginToken.charOffset,
|
| + deprecated_addCompileTimeError(beginToken.charOffset,
|
| "Can't be used as a type: '${debugName(prefix, suffix)}'.");
|
| return;
|
| }
|
| @@ -1689,7 +1702,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (name is TypeDeclarationAccessor) {
|
| push(name.buildType(arguments));
|
| } else if (name is FastaAccessor) {
|
| - warningNotError(
|
| + deprecated_warningNotError(
|
| "'${beginToken.lexeme}' isn't a type.", beginToken.charOffset);
|
| push(const InvalidType());
|
| } else if (name is TypeBuilder) {
|
| @@ -1699,7 +1712,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| } else if (name is String) {
|
| push(kernelTypeFromString(name, arguments, beginToken.charOffset));
|
| } else {
|
| - internalError("Unhandled: '${name.runtimeType}'.");
|
| + deprecated_internalProblem("Unhandled: '${name.runtimeType}'.");
|
| }
|
| }
|
|
|
| @@ -1721,9 +1734,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (existing == null) {
|
| scopeBuilder.addMember(name, builder);
|
| } else {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| builder.charOffset, "'$name' already declared in this scope.");
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| existing.charOffset, "Previous definition of '$name'.");
|
| }
|
| }
|
| @@ -1753,7 +1766,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| DartType type = pop();
|
| Expression expression = popForValue();
|
| if (constantExpressionRequired) {
|
| - push(buildCompileTimeError(
|
| + push(deprecated_buildCompileTimeError(
|
| "Not a constant expression.", operator.charOffset));
|
| } else {
|
| push(new KernelAsExpression(expression, type)
|
| @@ -1777,7 +1790,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| type, functionNestingLevel);
|
| }
|
| if (constantExpressionRequired) {
|
| - push(buildCompileTimeError(
|
| + push(deprecated_buildCompileTimeError(
|
| "Not a constant expression.", operator.charOffset));
|
| } else {
|
| push(isExpression);
|
| @@ -1799,7 +1812,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| debugEvent("ThrowExpression");
|
| Expression expression = popForValue();
|
| if (constantExpressionRequired) {
|
| - push(buildCompileTimeError(
|
| + push(deprecated_buildCompileTimeError(
|
| "Not a constant expression.", throwToken.charOffset));
|
| } else {
|
| push(
|
| @@ -1813,7 +1826,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| debugEvent("FormalParameter");
|
| if (thisKeyword != null) {
|
| if (!inConstructor) {
|
| - addCompileTimeError(thisKeyword.charOffset,
|
| + deprecated_addCompileTimeError(thisKeyword.charOffset,
|
| "'this' parameters can only be used on constructors.");
|
| thisKeyword = null;
|
| }
|
| @@ -1834,7 +1847,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| ProcedureBuilder member = this.member;
|
| KernelFormalParameterBuilder formal = member.getFormal(name.name);
|
| if (formal == null) {
|
| - internalError("Internal error: formal missing for '${name.name}'");
|
| + deprecated_internalProblem(
|
| + "Internal error: formal missing for '${name.name}'");
|
| } else {
|
| variable = formal.build(library);
|
| variable.initializer = name.initializer;
|
| @@ -1964,7 +1978,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (catchParameters.required.length > 2 ||
|
| catchParameters.optional != null) {
|
| body = new Block(<Statement>[
|
| - compileTimeErrorInTry ??= buildCompileTimeErrorStatement(
|
| + compileTimeErrorInTry ??= deprecated_buildCompileTimeErrorStatement(
|
| "Invalid catch arguments.", catchKeyword.next.charOffset)
|
| ]);
|
| }
|
| @@ -2044,7 +2058,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| Name incrementOperator(Token token) {
|
| if (optional("++", token)) return plusName;
|
| if (optional("--", token)) return minusName;
|
| - return internalError("Unknown increment operator: ${token.lexeme}");
|
| + return deprecated_internalProblem(
|
| + "Unknown increment operator: ${token.lexeme}");
|
| }
|
|
|
| @override
|
| @@ -2055,7 +2070,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| push(accessor.buildPrefixIncrement(incrementOperator(token),
|
| offset: token.charOffset));
|
| } else {
|
| - push(wrapInCompileTimeError(toValue(accessor), "Can't assign to this."));
|
| + push(deprecated_wrapInCompileTimeError(
|
| + toValue(accessor), "Can't assign to this."));
|
| }
|
| }
|
|
|
| @@ -2067,7 +2083,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| push(new DelayedPostfixIncrement(
|
| this, token, accessor, incrementOperator(token), null));
|
| } else {
|
| - push(wrapInCompileTimeError(toValue(accessor), "Can't assign to this."));
|
| + push(deprecated_wrapInCompileTimeError(
|
| + toValue(accessor), "Can't assign to this."));
|
| }
|
| }
|
|
|
| @@ -2159,7 +2176,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| }
|
| if (target is Constructor) {
|
| if (isConst && !target.isConst) {
|
| - return buildCompileTimeError("Not a const constructor.", charOffset);
|
| + return deprecated_buildCompileTimeError(
|
| + "Not a const constructor.", charOffset);
|
| }
|
| return new KernelConstructorInvocation(target, initialTarget, arguments,
|
| isConst: isConst)
|
| @@ -2167,7 +2185,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| } else {
|
| Procedure procedure = target;
|
| if (isConst && !procedure.isConst) {
|
| - return buildCompileTimeError("Not a const factory.", charOffset);
|
| + return deprecated_buildCompileTimeError(
|
| + "Not a const factory.", charOffset);
|
| } else if (procedure.isFactory) {
|
| return new KernelFactoryConstructorInvocation(
|
| target, initialTarget, arguments,
|
| @@ -2218,7 +2237,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| debugEvent("beginNewExpression");
|
| super.push(constantExpressionRequired);
|
| if (constantExpressionRequired) {
|
| - addCompileTimeError(token.charOffset, "Not a constant expression.");
|
| + deprecated_addCompileTimeError(
|
| + token.charOffset, "Not a constant expression.");
|
| }
|
| constantExpressionRequired = false;
|
| }
|
| @@ -2260,7 +2280,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| bool savedConstantExpressionRequired = pop();
|
| () {
|
| if (arguments == null) {
|
| - push(buildCompileTimeError("No arguments.", nameToken.charOffset));
|
| + push(deprecated_buildCompileTimeError(
|
| + "No arguments.", nameToken.charOffset));
|
| return;
|
| }
|
|
|
| @@ -2272,7 +2293,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| String errorName;
|
| if (type is ClassBuilder) {
|
| if (type is EnumBuilder) {
|
| - push(buildCompileTimeError(
|
| + push(deprecated_buildCompileTimeError(
|
| "An enum class can't be instantiated.", nameToken.charOffset));
|
| return;
|
| }
|
| @@ -2297,7 +2318,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| initialTarget = b.target;
|
| target = getRedirectionTarget(initialTarget);
|
| if (target == null) {
|
| - push(buildCompileTimeError(
|
| + push(deprecated_buildCompileTimeError(
|
| "Cyclic definition of factory '${name}'.",
|
| nameToken.charOffset));
|
| return;
|
| @@ -2353,7 +2374,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (context.isScopeReference && isInstanceContext) {
|
| push(new ThisAccessor(this, token, inInitializer));
|
| } else {
|
| - push(new IncompleteError(
|
| + push(new deprecated_IncompleteError(
|
| this, token, "Expected identifier, but got 'this'."));
|
| }
|
| }
|
| @@ -2366,7 +2387,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| member.transformerFlags |= TransformerFlag.superCalls;
|
| push(new ThisAccessor(this, token, inInitializer, isSuper: true));
|
| } else {
|
| - push(new IncompleteError(
|
| + push(new deprecated_IncompleteError(
|
| this, token, "Expected identifier, but got 'super'."));
|
| }
|
| }
|
| @@ -2389,7 +2410,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| isFinal: true, isLocalFunction: true)
|
| ..fileOffset = offsetForToken(name.token);
|
| if (scope.local[variable.name] != null) {
|
| - addCompileTimeError(offsetForToken(name.token),
|
| + deprecated_addCompileTimeError(offsetForToken(name.token),
|
| "'${variable.name}' already declared in this scope.");
|
| }
|
| push(new KernelFunctionDeclaration(
|
| @@ -2488,7 +2509,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| ..fileOffset = beginToken.charOffset
|
| ..fileEndOffset = token.charOffset);
|
| if (constantExpressionRequired) {
|
| - push(buildCompileTimeError(
|
| + push(deprecated_buildCompileTimeError(
|
| "Not a constant expression.", formals.charOffset));
|
| } else {
|
| push(new KernelFunctionExpression(function)
|
| @@ -2549,7 +2570,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| declaresVariable = true;
|
| variable = lvalue;
|
| if (variable.isConst) {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| variable.fileOffset, "A for-in loop-variable can't be 'const'.");
|
| }
|
| } else if (lvalue is FastaAccessor) {
|
| @@ -2569,8 +2590,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| .buildAssignment(new VariableGet(variable), voidContext: true))),
|
| body);
|
| } else {
|
| - variable = new VariableDeclaration.forValue(buildCompileTimeError(
|
| - "Expected lvalue, but got ${lvalue}", forToken.next.next.charOffset));
|
| + variable = new VariableDeclaration.forValue(
|
| + deprecated_buildCompileTimeError("Expected lvalue, but got ${lvalue}",
|
| + forToken.next.next.charOffset));
|
| }
|
| Statement result = new KernelForInStatement(
|
| variable, expression, body, declaresVariable,
|
| @@ -2631,7 +2653,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| push(new KernelExpressionStatement(
|
| new KernelRethrow()..fileOffset = offsetForToken(rethrowToken)));
|
| } else {
|
| - push(buildCompileTimeErrorStatement(
|
| + push(deprecated_buildCompileTimeErrorStatement(
|
| "'rethrow' can only be used in catch clauses.",
|
| rethrowToken.charOffset));
|
| }
|
| @@ -2693,7 +2715,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| break;
|
|
|
| case Assert.Expression:
|
| - push(buildCompileTimeError("`assert` can't be used as an expression."));
|
| + push(deprecated_buildCompileTimeError(
|
| + "`assert` can't be used as an expression."));
|
| break;
|
|
|
| case Assert.Initializer:
|
| @@ -2820,7 +2843,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| for (int i = 0; i < caseCount - 1; i++) {
|
| SwitchCase current = cases[i];
|
| if (current.isDefault) {
|
| - addCompileTimeError(current.fileOffset,
|
| + deprecated_addCompileTimeError(current.fileOffset,
|
| "'default' switch case should be the last case.");
|
| continue;
|
| }
|
| @@ -2877,17 +2900,20 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| target = scope.lookupLabel(identifier.name);
|
| }
|
| if (target == null && name == null) {
|
| - push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
| - "No target of break.", breakKeyword.charOffset));
|
| + push(compileTimeErrorInLoopOrSwitch =
|
| + deprecated_buildCompileTimeErrorStatement(
|
| + "No target of break.", breakKeyword.charOffset));
|
| } else if (target == null ||
|
| target is! JumpTarget ||
|
| !target.isBreakTarget) {
|
| - push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
| - "Can't break to '$name'.", breakKeyword.next.charOffset));
|
| + push(compileTimeErrorInLoopOrSwitch =
|
| + deprecated_buildCompileTimeErrorStatement(
|
| + "Can't break to '$name'.", breakKeyword.next.charOffset));
|
| } else if (target.functionNestingLevel != functionNestingLevel) {
|
| - push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
| - "Can't break to '$name' in a different function.",
|
| - breakKeyword.next.charOffset));
|
| + push(compileTimeErrorInLoopOrSwitch =
|
| + deprecated_buildCompileTimeErrorStatement(
|
| + "Can't break to '$name' in a different function.",
|
| + breakKeyword.next.charOffset));
|
| } else {
|
| BreakStatement statement = new KernelBreakStatement(null)
|
| ..fileOffset = breakKeyword.charOffset;
|
| @@ -2907,13 +2933,15 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| name = identifier.name;
|
| target = scope.lookupLabel(identifier.name);
|
| if (target != null && target is! JumpTarget) {
|
| - push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
| - "Target of continue must be a label.", continueKeyword.charOffset));
|
| + push(compileTimeErrorInLoopOrSwitch =
|
| + deprecated_buildCompileTimeErrorStatement(
|
| + "Target of continue must be a label.",
|
| + continueKeyword.charOffset));
|
| return;
|
| }
|
| if (target == null) {
|
| if (switchScope == null) {
|
| - push(buildCompileTimeErrorStatement(
|
| + push(deprecated_buildCompileTimeErrorStatement(
|
| "Can't find label '$name'.", continueKeyword.next.charOffset));
|
| return;
|
| }
|
| @@ -2930,15 +2958,18 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| }
|
| }
|
| if (target == null) {
|
| - push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
| - "No target of continue.", continueKeyword.charOffset));
|
| + push(compileTimeErrorInLoopOrSwitch =
|
| + deprecated_buildCompileTimeErrorStatement(
|
| + "No target of continue.", continueKeyword.charOffset));
|
| } else if (!target.isContinueTarget) {
|
| - push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
| - "Can't continue at '$name'.", continueKeyword.next.charOffset));
|
| + push(compileTimeErrorInLoopOrSwitch =
|
| + deprecated_buildCompileTimeErrorStatement(
|
| + "Can't continue at '$name'.", continueKeyword.next.charOffset));
|
| } else if (target.functionNestingLevel != functionNestingLevel) {
|
| - push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
| - "Can't continue at '$name' in a different function.",
|
| - continueKeyword.next.charOffset));
|
| + push(compileTimeErrorInLoopOrSwitch =
|
| + deprecated_buildCompileTimeErrorStatement(
|
| + "Can't continue at '$name' in a different function.",
|
| + continueKeyword.next.charOffset));
|
| } else {
|
| BreakStatement statement = new KernelBreakStatement(null)
|
| ..fileOffset = continueKeyword.charOffset;
|
| @@ -2953,7 +2984,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| DartType bound = pop();
|
| if (bound != null) {
|
| // TODO(ahe): To handle F-bounded types, this needs to be a TypeBuilder.
|
| - warningNotError("Type variable bounds not implemented yet.",
|
| + deprecated_warningNotError("Type variable bounds not implemented yet.",
|
| offsetForToken(extendsOrSuper.next));
|
| }
|
| Identifier name = pop();
|
| @@ -3001,7 +3032,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| bool silent = hasParserError ||
|
| message.code == codeFinalFieldWithoutInitializer ||
|
| message.code == codeConstFieldWithoutInitializer;
|
| - addCompileTimeError(message.charOffset, message.message, silent: silent);
|
| + deprecated_addCompileTimeError(message.charOffset, message.message,
|
| + silent: silent);
|
| }
|
|
|
| @override
|
| @@ -3021,27 +3053,31 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| }
|
|
|
| @override
|
| - Expression buildCompileTimeError(error, [int charOffset = -1]) {
|
| + Expression deprecated_buildCompileTimeError(error, [int charOffset = -1]) {
|
| // TODO(ahe): This method should be passed the erroneous expression, wrap
|
| // it in a class (TBD) from which the erroneous expression can be easily
|
| // extracted. Similar for statements and initializers. See also [issue
|
| // 29717](https://github.com/dart-lang/sdk/issues/29717)
|
| - addCompileTimeError(charOffset, error, wasHandled: true);
|
| + deprecated_addCompileTimeError(charOffset, error, wasHandled: true);
|
| return new KernelSyntheticExpression(library.loader
|
| - .throwCompileConstantError(library.loader.buildCompileTimeError(
|
| - formatUnexpected(uri, charOffset, error), charOffset)));
|
| + .throwCompileConstantError(library.loader
|
| + .deprecated_buildCompileTimeError(
|
| + deprecated_formatUnexpected(uri, charOffset, error),
|
| + charOffset)));
|
| }
|
|
|
| - Expression wrapInCompileTimeError(Expression expression, String message) {
|
| + Expression deprecated_wrapInCompileTimeError(
|
| + Expression expression, String message) {
|
| return new Let(
|
| new VariableDeclaration.forValue(expression)
|
| ..fileOffset = expression.fileOffset,
|
| - buildCompileTimeError(message, expression.fileOffset))
|
| + deprecated_buildCompileTimeError(message, expression.fileOffset))
|
| ..fileOffset = expression.fileOffset;
|
| }
|
|
|
| Expression buildFallThroughError(int charOffset) {
|
| - warningNotError("Switch case may fall through to next case.", charOffset);
|
| + deprecated_warningNotError(
|
| + "Switch case may fall through to next case.", charOffset);
|
|
|
| Location location = messages.getLocationFromUri(uri, charOffset);
|
|
|
| @@ -3056,16 +3092,18 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
|
|
| Expression buildAbstractClassInstantiationError(String className,
|
| [int charOffset = -1]) {
|
| - warning("The class '$className' is abstract and can't be instantiated.",
|
| + deprecated_warning(
|
| + "The class '$className' is abstract and can't be instantiated.",
|
| charOffset);
|
| Builder constructor = library.loader.getAbstractClassInstantiationError();
|
| return new Throw(buildStaticInvocation(constructor.target,
|
| new KernelArguments(<Expression>[new StringLiteral(className)])));
|
| }
|
|
|
| - Statement buildCompileTimeErrorStatement(error, [int charOffset = -1]) {
|
| + Statement deprecated_buildCompileTimeErrorStatement(error,
|
| + [int charOffset = -1]) {
|
| return new KernelExpressionStatement(
|
| - buildCompileTimeError(error, charOffset));
|
| + deprecated_buildCompileTimeError(error, charOffset));
|
| }
|
|
|
| @override
|
| @@ -3079,9 +3117,10 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| Initializer buildDuplicatedInitializer(
|
| String name, int offset, int previousInitializerOffset) {
|
| Initializer initializer = buildInvalidInitializer(
|
| - buildCompileTimeError("'$name' has already been initialized.", offset),
|
| + deprecated_buildCompileTimeError(
|
| + "'$name' has already been initialized.", offset),
|
| offset);
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| initializedFields[name], "'$name' was initialized here.");
|
| return initializer;
|
| }
|
| @@ -3100,11 +3139,12 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (builder.isFinal && builder.hasInitializer) {
|
| // TODO(ahe): If CL 2843733002 is landed, this becomes a compile-time
|
| // error. Also, this is a compile-time error in strong mode.
|
| - warningNotError(
|
| + deprecated_warningNotError(
|
| "'$name' is final instance variable that has already been "
|
| "initialized.",
|
| offset);
|
| - warningNotError("'$name' was initialized here.", builder.charOffset);
|
| + deprecated_warningNotError(
|
| + "'$name' was initialized here.", builder.charOffset);
|
| Builder constructor =
|
| library.loader.getDuplicatedFieldInitializerError();
|
| return buildInvalidInitializer(
|
| @@ -3118,7 +3158,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| }
|
| } else {
|
| return buildInvalidInitializer(
|
| - buildCompileTimeError(
|
| + deprecated_buildCompileTimeError(
|
| "'$name' isn't an instance field of this class.", offset),
|
| offset);
|
| }
|
| @@ -3130,7 +3170,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| [int charOffset = -1]) {
|
| if (member.isConst && !constructor.isConst) {
|
| return buildInvalidInitializer(
|
| - buildCompileTimeError("Super constructor isn't const.", charOffset),
|
| + deprecated_buildCompileTimeError(
|
| + "Super constructor isn't const.", charOffset),
|
| charOffset);
|
| }
|
| needsImplicitSuperInitializer = false;
|
| @@ -3149,7 +3190,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
|
|
| @override
|
| Expression buildProblemExpression(ProblemBuilder builder, int charOffset) {
|
| - return buildCompileTimeError(builder.message, charOffset);
|
| + return deprecated_buildCompileTimeError(
|
| + builder.deprecated_message, charOffset);
|
| }
|
|
|
| @override
|
| @@ -3165,11 +3207,11 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| }
|
|
|
| @override
|
| - dynamic addCompileTimeError(int charOffset, String message,
|
| + dynamic deprecated_addCompileTimeError(int charOffset, String message,
|
| {bool silent: false, bool wasHandled: false}) {
|
| // TODO(ahe): If constantExpressionRequired is set, set it to false to
|
| // avoid a long list of errors.
|
| - return library.addCompileTimeError(charOffset, message,
|
| + return library.deprecated_addCompileTimeError(charOffset, message,
|
| fileUri: uri, silent: silent, wasHandled: wasHandled);
|
| }
|
|
|
| @@ -3179,22 +3221,23 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| push(NullValue.FunctionBody);
|
| } else {
|
| push(new Block(<Statement>[
|
| - buildCompileTimeErrorStatement("Expected '{'.", token.charOffset)
|
| + deprecated_buildCompileTimeErrorStatement(
|
| + "Expected '{'.", token.charOffset)
|
| ]));
|
| }
|
| }
|
|
|
| @override
|
| - void warning(String message, [int charOffset = -1]) {
|
| + void deprecated_warning(String message, [int charOffset = -1]) {
|
| if (constantExpressionRequired) {
|
| - addCompileTimeError(charOffset, message);
|
| + deprecated_addCompileTimeError(charOffset, message);
|
| } else {
|
| - super.warning(message, charOffset);
|
| + super.deprecated_warning(message, charOffset);
|
| }
|
| }
|
|
|
| - void warningNotError(String message, [int charOffset = -1]) {
|
| - super.warning(message, charOffset);
|
| + void deprecated_warningNotError(String message, [int charOffset = -1]) {
|
| + super.deprecated_warning(message, charOffset);
|
| }
|
|
|
| @override
|
| @@ -3203,13 +3246,13 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| if (!isInstanceContext && type.parameter.parent is Class) {
|
| String message = "Type variables can't be used in static members.";
|
| if (nonInstanceAccessIsError) {
|
| - addCompileTimeError(offset, message);
|
| + deprecated_addCompileTimeError(offset, message);
|
| } else {
|
| - warning(message, offset);
|
| + deprecated_warning(message, offset);
|
| }
|
| return const InvalidType();
|
| } else if (constantExpressionRequired) {
|
| - addCompileTimeError(
|
| + deprecated_addCompileTimeError(
|
| offset,
|
| "Type variable '${type.parameter.name}' can't be used as a constant "
|
| "expression $type.");
|
| @@ -3243,7 +3286,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
| bool isNullAware: false,
|
| bool isImplicitCall: false}) {
|
| if (constantExpressionRequired && !isConstantExpression) {
|
| - return buildCompileTimeError("Not a constant expression.", offset);
|
| + return deprecated_buildCompileTimeError(
|
| + "Not a constant expression.", offset);
|
| }
|
| if (isNullAware) {
|
| VariableDeclaration variable = new VariableDeclaration.forValue(receiver);
|
| @@ -3266,7 +3310,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
|
|
| @override
|
| void addCompileTimeErrorFromMessage(FastaMessage message) {
|
| - library.addCompileTimeError(message.charOffset, message.message,
|
| + library.deprecated_addCompileTimeError(message.charOffset, message.message,
|
| fileUri: message.uri);
|
| }
|
|
|
| @@ -3327,10 +3371,12 @@ abstract class ContextAccessor extends FastaAccessor {
|
|
|
| ContextAccessor(this.helper, this.token, this.accessor);
|
|
|
| - String get plainNameForRead => internalError("Unsupported operation.");
|
| + String get plainNameForRead =>
|
| + deprecated_internalProblem("Unsupported operation.");
|
|
|
| Expression doInvocation(int charOffset, Arguments arguments) {
|
| - return internalError("Unhandled: ${runtimeType}", uri, charOffset);
|
| + return deprecated_internalProblem(
|
| + "Unhandled: ${runtimeType}", uri, charOffset);
|
| }
|
|
|
| Expression buildSimpleRead();
|
| @@ -3369,10 +3415,10 @@ abstract class ContextAccessor extends FastaAccessor {
|
| return makeInvalidWrite(null);
|
| }
|
|
|
| - makeInvalidRead() => internalError("not supported");
|
| + makeInvalidRead() => deprecated_internalProblem("not supported");
|
|
|
| Expression makeInvalidWrite(Expression value) {
|
| - return helper.buildCompileTimeError(
|
| + return helper.deprecated_buildCompileTimeError(
|
| "Can't be used as left-hand side of assignment.",
|
| offsetForToken(token));
|
| }
|
| @@ -3397,7 +3443,7 @@ class DelayedAssignment extends ContextAccessor {
|
|
|
| Expression handleAssignment(bool voidContext) {
|
| if (helper.constantExpressionRequired) {
|
| - return helper.buildCompileTimeError(
|
| + return helper.deprecated_buildCompileTimeError(
|
| "Not a constant expression.", offsetForToken(token));
|
| }
|
| if (identical("=", assignmentOperator)) {
|
| @@ -3440,7 +3486,7 @@ class DelayedAssignment extends ContextAccessor {
|
| return accessor.buildCompoundAssignment(mustacheName, value,
|
| offset: offsetForToken(token), voidContext: voidContext);
|
| } else {
|
| - return internalError("Unhandled: $assignmentOperator");
|
| + return deprecated_internalProblem("Unhandled: $assignmentOperator");
|
| }
|
| }
|
|
|
| @@ -3557,9 +3603,11 @@ class LabelTarget extends Builder implements JumpTarget {
|
|
|
| bool get hasUsers => breakTarget.hasUsers || continueTarget.hasUsers;
|
|
|
| - List<Statement> get users => internalError("Unsupported operation.");
|
| + List<Statement> get users =>
|
| + deprecated_internalProblem("Unsupported operation.");
|
|
|
| - JumpTargetKind get kind => internalError("Unsupported operation.");
|
| + JumpTargetKind get kind =>
|
| + deprecated_internalProblem("Unsupported operation.");
|
|
|
| bool get isBreakTarget => true;
|
|
|
| @@ -3576,7 +3624,7 @@ class LabelTarget extends Builder implements JumpTarget {
|
| }
|
|
|
| void addGoto(ContinueSwitchStatement statement) {
|
| - internalError("Unsupported operation.");
|
| + deprecated_internalProblem("Unsupported operation.");
|
| }
|
|
|
| void resolveBreaks(LabeledStatement target) {
|
| @@ -3588,7 +3636,7 @@ class LabelTarget extends Builder implements JumpTarget {
|
| }
|
|
|
| void resolveGotos(SwitchCase target) {
|
| - internalError("Unsupported operation.");
|
| + deprecated_internalProblem("Unsupported operation.");
|
| }
|
|
|
| @override
|
| @@ -3661,7 +3709,8 @@ class FormalParameters {
|
|
|
| for (VariableDeclaration parameter in required) {
|
| if (local[parameter.name] != null) {
|
| - helper.addCompileTimeError(parameter.fileOffset, "Duplicated name.");
|
| + helper.deprecated_addCompileTimeError(
|
| + parameter.fileOffset, "Duplicated name.");
|
| }
|
| local[parameter.name] =
|
| new KernelVariableBuilder(parameter, builder, builder.fileUri);
|
| @@ -3669,7 +3718,8 @@ class FormalParameters {
|
| if (optional != null) {
|
| for (VariableDeclaration parameter in optional.formals) {
|
| if (local[parameter.name] != null) {
|
| - helper.addCompileTimeError(parameter.fileOffset, "Duplicated name.");
|
| + helper.deprecated_addCompileTimeError(
|
| + parameter.fileOffset, "Duplicated name.");
|
| }
|
| local[parameter.name] =
|
| new KernelVariableBuilder(parameter, builder, builder.fileUri);
|
| @@ -3712,7 +3762,7 @@ String getNodeName(Object node) {
|
| } else if (node is FastaAccessor) {
|
| return node.plainNameForRead;
|
| } else {
|
| - return internalError("Unhandled: ${node.runtimeType}");
|
| + return deprecated_internalProblem("Unhandled: ${node.runtimeType}");
|
| }
|
| }
|
|
|
| @@ -3732,6 +3782,6 @@ AsyncMarker asyncMarkerFromTokens(Token asyncToken, Token starToken) {
|
| return AsyncMarker.AsyncStar;
|
| }
|
| } else {
|
| - return internalError("Unknown async modifier: $asyncToken");
|
| + return deprecated_internalProblem("Unknown async modifier: $asyncToken");
|
| }
|
| }
|
|
|