Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2790743004: Handle unresolved identifiers with an accessor. (Closed)
Patch Set: Update status file. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b4f385e97411f2048b1abd98c64c785a4f0bbead..8d93df53e28ca74ea38502be8f37e6b39469a198 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -145,18 +145,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
@override
Expression toValue(Object node) {
- if (node is UnresolvedIdentifier) {
- if (isDartLibrary &&
- node.name.name == "main" &&
- library.uri.path == "_builtin" &&
- member?.name == "_getMainClosure") {
- // TODO(ahe): https://github.com/dart-lang/sdk/issues/28989
- return new NullLiteral()..fileOffset = node.fileOffset;
- }
- return throwNoSuchMethodError(
- node.name.name, new Arguments.empty(), node.fileOffset,
- isGetter: true);
- } else if (node is FastaAccessor) {
+ if (node is FastaAccessor) {
return node.buildSimpleRead();
} else if (node is TypeVariableBuilder) {
TypeParameterType type = node.buildTypesWithBuiltArguments(library, null);
@@ -531,9 +520,6 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
addCompileTimeError(charOffset, "Not a constant expression.");
}
return receiver.doInvocation(charOffset, arguments);
- } else if (receiver is UnresolvedIdentifier) {
- return throwNoSuchMethodError(
- receiver.name.name, arguments, receiver.fileOffset);
} else {
return buildMethodInvocation(
toValue(receiver), callName, arguments, charOffset);
@@ -761,11 +747,14 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
addCompileTimeError(charOffset, "Not a constant expression.");
}
return new ThisPropertyAccessor(this, charOffset, n, null, null);
+ } else if (isDartLibrary &&
+ name == "main" &&
+ library.uri.path == "_builtin" &&
+ member?.name == "_getMainClosure") {
+ // TODO(ahe): https://github.com/dart-lang/sdk/issues/28989
+ return new NullLiteral()..fileOffset = charOffset;
} else {
- if (constantExpressionRequired) {
- addCompileTimeError(charOffset, "Not a constant expression.");
- }
- return new UnresolvedIdentifier(n)..fileOffset = charOffset;
+ return new UnresolvedAccessor(this, n, charOffset);
}
} else if (builder.isTypeDeclaration) {
if (constantExpressionRequired && builder.isTypeVariable) {
@@ -1305,9 +1294,6 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
if (name is FastaAccessor) {
warning("'${beginToken.lexeme}' isn't a type.", beginToken.charOffset);
push(const DynamicType());
- } else if (name is UnresolvedIdentifier) {
- warning("'${name.name}' isn't a type.", beginToken.charOffset);
- push(const DynamicType());
} else if (name is TypeVariableBuilder) {
if (constantExpressionRequired) {
addCompileTimeError(
@@ -2458,15 +2444,6 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
}
// TODO(ahe): Shouldn't need to be an expression.
-class UnresolvedIdentifier extends InvalidExpression {
- final Name name;
-
- UnresolvedIdentifier(this.name);
-
- String toString() => "unresolved-identifier($name)";
-}
-
-// TODO(ahe): Shouldn't need to be an expression.
class Identifier extends InvalidExpression {
final String name;
@@ -2917,8 +2894,6 @@ String debugName(String className, String name, [String prefix]) {
String getNodeName(Object node) {
if (node is Identifier) {
return node.name;
- } else if (node is UnresolvedIdentifier) {
- return node.name.name;
} else if (node is TypeDeclarationBuilder) {
return node.name;
} else if (node is PrefixBuilder) {
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698