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 dea40020c2d3292970e926a721eda13f5245c66e..fede4adf9e047f8f03ceece1f1a5e108aa71ec5f 100644 |
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart |
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart |
@@ -28,9 +28,10 @@ import 'package:front_end/src/fasta/type_inference/type_promotion.dart' |
import 'package:kernel/ast.dart' |
hide InvalidExpression, InvalidInitializer, InvalidStatement; |
-import '../errors.dart' show internalError; |
+import '../deprecated_problems.dart' show deprecated_internalProblem; |
-import '../scope.dart' show AccessErrorBuilder, ProblemBuilder, Scope; |
+import '../scope.dart' |
+ show deprecated_AccessErrorBuilder, ProblemBuilder, Scope; |
import 'frontend_accessors.dart' as kernel |
show |
@@ -80,7 +81,7 @@ abstract class BuilderHelper { |
finishSend(Object receiver, Arguments arguments, int offset); |
- Expression buildCompileTimeError(error, [int offset]); |
+ Expression deprecated_buildCompileTimeError(error, [int offset]); |
Initializer buildInvalidInitializer(Expression expression, [int offset]); |
@@ -108,7 +109,8 @@ abstract class BuilderHelper { |
StaticGet makeStaticGet(Member readTarget, Token token); |
- dynamic addCompileTimeError(int charOffset, String message, {bool silent}); |
+ dynamic deprecated_addCompileTimeError(int charOffset, String message, |
+ {bool silent}); |
bool isIdentical(Member member); |
@@ -119,7 +121,7 @@ abstract class BuilderHelper { |
DartType validatedTypeVariableUse( |
TypeParameterType type, int offset, bool nonInstanceAccessIsError); |
- void warning(String message, [int charOffset]); |
+ void deprecated_warning(String message, [int charOffset]); |
void warnUnresolvedSuperGet(Name name, int charOffset); |
@@ -144,7 +146,7 @@ abstract class FastaAccessor implements Accessor { |
Initializer buildFieldInitializer(Map<String, int> initializedFields) { |
int offset = offsetForToken(token); |
return helper.buildInvalidInitializer( |
- helper.buildCompileTimeError( |
+ helper.deprecated_buildCompileTimeError( |
// TODO(ahe): This error message is really bad. |
"Can't use $plainNameForRead here.", |
offset), |
@@ -176,7 +178,7 @@ abstract class FastaAccessor implements Accessor { |
isNullAware: isNullAware); |
} else { |
if (helper.constantExpressionRequired && send.name != lengthName) { |
- helper.addCompileTimeError( |
+ helper.deprecated_addCompileTimeError( |
offsetForToken(token), "Not a constant expression."); |
} |
return PropertyAccessor.make(helper, send.token, buildSimpleRead(), |
@@ -214,7 +216,7 @@ abstract class ErrorAccessor implements FastaAccessor { |
Expression buildError(Arguments arguments, |
{bool isGetter: false, bool isSetter: false, int offset}); |
- Name get name => internalError("Unsupported operation."); |
+ Name get name => deprecated_internalProblem("Unsupported operation."); |
@override |
String get plainNameForRead => name.name; |
@@ -314,13 +316,14 @@ class ThisAccessor extends FastaAccessor { |
ThisAccessor(this.helper, this.token, this.isInitializer, |
{this.isSuper: false}); |
- String get plainNameForRead => internalError(isSuper ? "super" : "this"); |
+ String get plainNameForRead => |
+ deprecated_internalProblem(isSuper ? "super" : "this"); |
Expression buildSimpleRead() { |
if (!isSuper) { |
return new KernelThisExpression(); |
} else { |
- return helper.buildCompileTimeError( |
+ return helper.deprecated_buildCompileTimeError( |
"Can't use `super` as an expression.", offsetForToken(token)); |
} |
} |
@@ -330,7 +333,7 @@ class ThisAccessor extends FastaAccessor { |
String keyword = isSuper ? "super" : "this"; |
int offset = offsetForToken(token); |
return helper.buildInvalidInitializer( |
- helper.buildCompileTimeError( |
+ helper.deprecated_buildCompileTimeError( |
"Can't use '$keyword' here, did you mean '$keyword()'?", offset), |
offset); |
} |
@@ -339,7 +342,7 @@ class ThisAccessor extends FastaAccessor { |
IncompleteSend send, int operatorOffset, bool isNullAware) { |
if (isInitializer && send is SendAccessor) { |
if (isNullAware) { |
- helper.addCompileTimeError( |
+ helper.deprecated_addCompileTimeError( |
operatorOffset, "Expected '.'\nTry removing '?'."); |
} |
return buildConstructorInitializer( |
@@ -430,7 +433,8 @@ class ThisAccessor extends FastaAccessor { |
Expression buildAssignmentError() { |
String message = |
isSuper ? "Can't assign to 'super'." : "Can't assign to 'this'."; |
- return helper.buildCompileTimeError(message, offsetForToken(token)); |
+ return helper.deprecated_buildCompileTimeError( |
+ message, offsetForToken(token)); |
} |
toString() { |
@@ -454,16 +458,16 @@ abstract class IncompleteSend extends FastaAccessor { |
Arguments get arguments => null; |
} |
-class IncompleteError extends IncompleteSend with ErrorAccessor { |
+class deprecated_IncompleteError extends IncompleteSend with ErrorAccessor { |
final Object error; |
- IncompleteError(BuilderHelper helper, Token token, this.error) |
+ deprecated_IncompleteError(BuilderHelper helper, Token token, this.error) |
: super(helper, token, null); |
@override |
Expression buildError(Arguments arguments, |
{bool isGetter: false, bool isSetter: false, int offset}) { |
- return helper.buildCompileTimeError( |
+ return helper.deprecated_buildCompileTimeError( |
error, offset ?? offsetForToken(this.token)); |
} |
@@ -483,11 +487,11 @@ class SendAccessor extends IncompleteSend { |
String get plainNameForRead => name.name; |
Expression buildSimpleRead() { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression buildAssignment(Expression value, {bool voidContext: false}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
withReceiver(Object receiver, int operatorOffset, {bool isNullAware: false}) { |
@@ -497,7 +501,7 @@ class SendAccessor extends IncompleteSend { |
if (receiver is PrefixBuilder) { |
PrefixBuilder prefix = receiver; |
if (isNullAware) { |
- helper.addCompileTimeError( |
+ helper.deprecated_addCompileTimeError( |
offsetForToken(token), |
"Library prefix '${prefix.name}' can't be used with null-aware " |
"operator.\nTry removing '?'."); |
@@ -514,7 +518,7 @@ class SendAccessor extends IncompleteSend { |
Expression buildNullAwareAssignment( |
Expression value, DartType type, int offset, |
{bool voidContext: false}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression buildCompoundAssignment(Name binaryOperator, Expression value, |
@@ -522,21 +526,21 @@ class SendAccessor extends IncompleteSend { |
bool voidContext: false, |
Procedure interfaceTarget, |
bool isPreIncDec: false}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression buildPrefixIncrement(Name binaryOperator, |
{int offset, bool voidContext: false, Procedure interfaceTarget}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression buildPostfixIncrement(Name binaryOperator, |
{int offset, bool voidContext: false, Procedure interfaceTarget}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression doInvocation(int offset, Arguments arguments) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
toString() { |
@@ -551,10 +555,10 @@ class IncompletePropertyAccessor extends IncompleteSend { |
String get plainNameForRead => name.name; |
- Expression buildSimpleRead() => internalError("Unhandled"); |
+ Expression buildSimpleRead() => deprecated_internalProblem("Unhandled"); |
Expression buildAssignment(Expression value, {bool voidContext: false}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
withReceiver(Object receiver, int operatorOffset, {bool isNullAware: false}) { |
@@ -564,7 +568,7 @@ class IncompletePropertyAccessor extends IncompleteSend { |
if (receiver is PrefixBuilder) { |
PrefixBuilder prefix = receiver; |
if (isNullAware) { |
- helper.addCompileTimeError( |
+ helper.deprecated_addCompileTimeError( |
offsetForToken(token), |
"Library prefix '${prefix.name}' can't be used with null-aware " |
"operator.\nTry removing '?'."); |
@@ -580,7 +584,7 @@ class IncompletePropertyAccessor extends IncompleteSend { |
Expression buildNullAwareAssignment( |
Expression value, DartType type, int offset, |
{bool voidContext: false}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression buildCompoundAssignment(Name binaryOperator, Expression value, |
@@ -588,21 +592,21 @@ class IncompletePropertyAccessor extends IncompleteSend { |
bool voidContext: false, |
Procedure interfaceTarget, |
bool isPreIncDec: false}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression buildPrefixIncrement(Name binaryOperator, |
{int offset, bool voidContext: false, Procedure interfaceTarget}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression buildPostfixIncrement(Name binaryOperator, |
{int offset, bool voidContext: false, Procedure interfaceTarget}) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
Expression doInvocation(int offset, Arguments arguments) { |
- return internalError("Unhandled"); |
+ return deprecated_internalProblem("Unhandled"); |
} |
toString() { |
@@ -700,14 +704,14 @@ class StaticAccessor extends kernel.StaticAccessor with FastaAccessor { |
factory StaticAccessor.fromBuilder(BuilderHelper helper, Builder builder, |
Token token, Builder builderSetter) { |
- if (builder is AccessErrorBuilder) { |
- AccessErrorBuilder error = builder; |
+ if (builder is deprecated_AccessErrorBuilder) { |
+ deprecated_AccessErrorBuilder error = builder; |
builder = error.builder; |
// We should only see an access error here if we've looked up a setter |
// when not explicitly looking for a setter. |
assert(builder.isSetter); |
} else if (builder.target == null) { |
- return internalError("Unhandled: ${builder}"); |
+ return deprecated_internalProblem("Unhandled: ${builder}"); |
} |
Member getter = builder.target.hasGetter ? builder.target : null; |
Member setter = builder.target.hasSetter ? builder.target : null; |
@@ -723,7 +727,8 @@ class StaticAccessor extends kernel.StaticAccessor with FastaAccessor { |
Expression doInvocation(int offset, Arguments arguments) { |
if (helper.constantExpressionRequired && !helper.isIdentical(readTarget)) { |
- helper.addCompileTimeError(offset, "Not a constant expression."); |
+ helper.deprecated_addCompileTimeError( |
+ offset, "Not a constant expression."); |
} |
if (readTarget == null || isFieldOrGetter(readTarget)) { |
return helper.buildMethodInvocation(buildSimpleRead(), callName, |
@@ -755,7 +760,8 @@ class SuperPropertyAccessor extends kernel.SuperPropertyAccessor |
Expression doInvocation(int offset, Arguments arguments) { |
if (helper.constantExpressionRequired) { |
- helper.addCompileTimeError(offset, "Not a constant expression."); |
+ helper.deprecated_addCompileTimeError( |
+ offset, "Not a constant expression."); |
} |
if (getter == null || isFieldOrGetter(getter)) { |
return helper.buildMethodInvocation( |
@@ -767,8 +773,10 @@ class SuperPropertyAccessor extends kernel.SuperPropertyAccessor |
} else { |
// TODO(ahe): This could be something like "super.property(...)" where |
// property is a setter. |
- return internalError("Unhandled invocation ${getter.runtimeType}.", |
- helper.uri, offsetForToken(token)); |
+ return deprecated_internalProblem( |
+ "Unhandled invocation ${getter.runtimeType}.", |
+ helper.uri, |
+ offsetForToken(token)); |
} |
} |
@@ -864,7 +872,7 @@ class NullAwarePropertyAccessor extends kernel.NullAwarePropertyAccessor |
String get plainNameForRead => name.name; |
Expression doInvocation(int offset, Arguments arguments) { |
- return internalError("Not implemented yet."); |
+ return deprecated_internalProblem("Not implemented yet."); |
} |
toString() => "NullAwarePropertyAccessor()"; |
@@ -921,7 +929,7 @@ class ParenthesizedExpression extends ReadOnlyAccessor { |
: super(helper, expression, null, token); |
Expression makeInvalidWrite(Expression value) { |
- return helper.buildCompileTimeError( |
+ return helper.deprecated_buildCompileTimeError( |
"Can't assign to a parenthesized expression.", offsetForToken(token)); |
} |
} |
@@ -939,9 +947,9 @@ class TypeDeclarationAccessor extends ReadOnlyAccessor { |
if (declaration is KernelInvalidTypeBuilder) { |
KernelInvalidTypeBuilder declaration = this.declaration; |
String message = declaration.message; |
- helper.library.addWarning(declaration.charOffset, message, |
+ helper.library.deprecated_addWarning(declaration.charOffset, message, |
fileUri: declaration.fileUri); |
- helper.warning(message, offset); |
+ helper.deprecated_warning(message, offset); |
super.expression = new Throw( |
new StringLiteral(message)..fileOffset = offsetForToken(token)) |
..fileOffset = offset; |
@@ -978,7 +986,8 @@ class TypeDeclarationAccessor extends ReadOnlyAccessor { |
FastaAccessor accessor; |
if (builder == null) { |
- // If we find a setter, [builder] is an [AccessErrorBuilder], not null. |
+ // If we find a setter, [builder] is an |
+ // [deprecated_AccessErrorBuilder], not null. |
accessor = new UnresolvedAccessor(helper, name, token); |
} else { |
Builder setter; |