Index: pkg/analyzer/lib/src/fasta/ast_builder.dart |
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart |
index 85fe8318bb0c59d99454c6d06a3ba7beec50f528..94cf9fe6b17cfedba7352f49df5c9442addc3b51 100644 |
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart |
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart |
@@ -9,30 +9,22 @@ import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; |
import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; |
import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; |
import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
-import 'package:analyzer/dart/element/element.dart' show Element; |
import 'package:front_end/src/fasta/parser/parser.dart' |
show Assert, FormalParameterType, MemberKind, Parser; |
import 'package:front_end/src/fasta/scanner/string_scanner.dart'; |
import 'package:front_end/src/fasta/scanner/token.dart' show CommentToken; |
import 'package:front_end/src/scanner/token.dart' as analyzer; |
-import 'package:front_end/src/fasta/problems.dart' show unexpected, unhandled; |
+import 'package:front_end/src/fasta/problems.dart' show unhandled; |
import 'package:front_end/src/fasta/messages.dart' |
show Code, Message, codeExpectedExpression, codeExpectedFunctionBody; |
import 'package:front_end/src/fasta/kernel/kernel_builder.dart' |
- show Builder, KernelLibraryBuilder, ProcedureBuilder, Scope; |
+ show Builder, KernelLibraryBuilder, Scope; |
import 'package:front_end/src/fasta/parser/identifier_context.dart' |
show IdentifierContext; |
import 'package:front_end/src/fasta/quote.dart'; |
import 'package:front_end/src/fasta/source/scope_listener.dart' |
show JumpTargetKind, NullValue, ScopeListener; |
-import 'analyzer.dart' show toKernel; |
-import 'element_store.dart' |
- show |
- AnalyzerLocalVariableElemment, |
- AnalyzerParameterElement, |
- ElementStore, |
- KernelClassElement; |
import 'package:analyzer/src/dart/error/syntactic_errors.dart'; |
class AstBuilder extends ScopeListener { |
@@ -41,7 +33,6 @@ class AstBuilder extends ScopeListener { |
final ErrorReporter errorReporter; |
final KernelLibraryBuilder library; |
final Builder member; |
- final ElementStore elementStore; |
@override |
final Uri uri; |
@@ -62,10 +53,8 @@ class AstBuilder extends ScopeListener { |
/// bodies. |
final bool isFullAst; |
- final bool generateKernel; |
- |
- AstBuilder(this.errorReporter, this.library, this.member, this.elementStore, |
- Scope scope, this.isFullAst, this.generateKernel, |
+ AstBuilder(this.errorReporter, this.library, this.member, Scope scope, |
+ this.isFullAst, |
[Uri uri]) |
: uri = uri ?? library.fileUri, |
super(scope); |
@@ -217,15 +206,6 @@ class AstBuilder extends ScopeListener { |
Comment comment = _toAnalyzerComment(token.precedingComments); |
push(ast.enumConstantDeclaration(comment, metadata, identifier)); |
} else { |
- if (context.isScopeReference) { |
- String name = token.lexeme; |
- Builder builder = scope.lookup(name, token.charOffset, uri); |
- if (builder != null) { |
- Element element = elementStore[builder]; |
- assert(element != null); |
- identifier.staticElement = element; |
- } |
- } |
push(identifier); |
} |
} |
@@ -300,17 +280,8 @@ class AstBuilder extends ScopeListener { |
} else { |
bodyStatement = (body as BlockFunctionBody).block; |
} |
- if (generateKernel) { |
- var kernel = |
- toKernel(bodyStatement, elementStore, library.library, scope); |
- if (member is ProcedureBuilder) { |
- ProcedureBuilder builder = member; |
- builder.body = kernel; |
- } else { |
- unexpected( |
- "procedure", "${member.runtimeType}", member.charOffset, uri); |
- } |
- } |
+ // TODO(paulberry): what do we need to do with bodyStatement at this point? |
+ bodyStatement; // Suppress "unused local variable" hint |
} |
void beginCascade(Token token) { |
@@ -526,12 +497,6 @@ class AstBuilder extends ScopeListener { |
unhandled("${node.runtimeType}", "identifier", nameToken.charOffset, uri); |
} |
push(variable); |
- scope.declare( |
- variable.name.name, |
- variable.name.staticElement = |
- new AnalyzerLocalVariableElemment(variable), |
- nameToken.charOffset, |
- uri); |
} |
void endVariablesDeclaration(int count, Token endToken) { |
@@ -679,10 +644,7 @@ class AstBuilder extends ScopeListener { |
debugEvent("Type"); |
TypeArgumentList arguments = pop(); |
Identifier name = pop(); |
- // TODO(paulberry,ahe): what if the type doesn't resolve to a class |
- // element? Try to share code with BodyBuilder.builderToFirstExpression. |
- KernelClassElement cls = name.staticElement; |
- push(ast.typeName(name, arguments)..type = cls?.rawType); |
+ push(ast.typeName(name, arguments)); |
} |
@override |
@@ -895,14 +857,6 @@ class AstBuilder extends ScopeListener { |
node = ast.defaultFormalParameter( |
node, analyzerKind, defaultValue?.separator, defaultValue?.value); |
} |
- |
- if (name != null) { |
- scope.declare( |
- name.name, |
- name.staticElement = new AnalyzerParameterElement(node), |
- name.offset, |
- uri); |
- } |
push(node); |
} |