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

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

Issue 2738693004: Parse script tags with Fasta. (Closed)
Patch Set: 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
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 175ce815a37f718341692f394f63bfc4beff0463..a07c75b362f50861b0bf568a3ab3abba1b1d3e0d 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
@@ -144,6 +144,11 @@ class AstBuilder extends ScopeListener {
}
}
+ void handleScript(Token token) {
+ debugEvent("Script");
+ push(ast.scriptTag(toAnalyzerToken(token)));
+ }
+
void handleStringJuxtaposition(int literalCount) {
debugEvent("StringJuxtaposition");
push(ast.adjacentStrings(popList(literalCount)));
@@ -848,14 +853,16 @@ class AstBuilder extends ScopeListener {
void endCompilationUnit(int count, Token token) {
debugEvent("CompilationUnit");
analyzer.Token beginToken = null; // TODO(paulberry)
- ScriptTag scriptTag = null; // TODO(paulberry)
+ ScriptTag scriptTag = null;
var directives = <Directive>[];
var declarations = <CompilationUnitMember>[];
analyzer.Token endToken = null; // TODO(paulberry)
List<Object> elements = popList(count);
if (elements != null) {
for (AstNode node in elements) {
- if (node is Directive) {
+ if (node is ScriptTag) {
+ scriptTag = node;
+ } else if (node is Directive) {
directives.add(node);
} else if (node is CompilationUnitMember) {
declarations.add(node);
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | pkg/front_end/lib/src/fasta/analyzer/token_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698