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

Unified Diff: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart

Issue 2706343002: Implement handleQualified with 1 dot. (Closed)
Patch Set: Created 3 years, 10 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 | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
index 3310536f2688c8f64d8d722e8c7aa6f09951bb13..558e49fcbb586950c26ae186594cd59c6d439fa3 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
@@ -457,18 +457,22 @@ class AstBuilder extends ScopeListener {
void endType(Token beginToken, Token endToken) {
debugEvent("Type");
TypeArgumentList arguments = pop();
- SimpleIdentifier name = pop();
+ Identifier name = pop();
+ // TODO(paulberry,ahe): what if the type doesn't resolve to a class
+ // element?
ahe 2017/02/22 11:42:08 We should try to share this method with BodyBuilde
Paul Berry 2017/02/22 16:34:53 Acknowledged.
KernelClassElement cls = name.staticElement;
if (cls == null) {
+ // TODO(paulberry): This is a kludge. Ideally we should already have
+ // set the static element at the time that handleIdentifier was called.
ahe 2017/02/22 11:42:08 For inspiration (or code sharing) take a look at B
Paul Berry 2017/02/22 16:34:53 Acknowledged.
Builder builder = scope.lookup(name.name, beginToken.charOffset, uri);
if (builder == null) {
internalError("Undefined name: $name");
}
- // TODO(paulberry,ahe): what if the type doesn't resolve to a class
- // element?
cls = elementStore[builder];
assert(cls != null);
- name.staticElement = cls;
+ if (name is SimpleIdentifier) {
+ name.staticElement = cls;
+ }
}
push(ast.typeName(name, arguments)..type = cls.rawType);
}
@@ -939,14 +943,20 @@ class AstBuilder extends ScopeListener {
@override
void handleQualified(Token period) {
+ SimpleIdentifier identifier = pop();
if (accumulateIdentifierComponents) {
- SimpleIdentifier identifier = pop();
List<SimpleIdentifier> list = pop();
list.add(identifier);
push(list);
} else {
- // TODO(paulberry): implement.
- logEvent('Qualified');
+ var prefix = pop();
+ if (prefix is SimpleIdentifier) {
+ // TODO(paulberry): resolve [identifier].
ahe 2017/02/22 11:42:08 I'm using SendAccessor to handle this in BodyBuild
Paul Berry 2017/02/22 16:34:53 Acknowledged.
+ push(ast.prefixedIdentifier(prefix, toAnalyzerToken(period), identifier));
ahe 2017/02/22 11:42:08 Long line.
Paul Berry 2017/02/22 16:34:53 Thanks. Konstantin fixed this in https://coderevi
+ } else {
+ // TODO(paulberry): implement.
+ logEvent('Qualified with >1 dot');
+ }
}
}
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698