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

Side by Side Diff: pkg/analyzer/lib/src/fasta/ast_builder.dart

Issue 2763833002: fasta.CommentToken implement analyzer.CommentToken (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.analyzer.ast_builder; 5 library fasta.analyzer.ast_builder;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory;
9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard;
10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; 10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (context.inLibraryOrPartOfDeclaration) { 178 if (context.inLibraryOrPartOfDeclaration) {
179 if (!context.isContinuation) { 179 if (!context.isContinuation) {
180 push([identifier]); 180 push([identifier]);
181 } else { 181 } else {
182 push(identifier); 182 push(identifier);
183 } 183 }
184 } else if (context == IdentifierContext.enumValueDeclaration) { 184 } else if (context == IdentifierContext.enumValueDeclaration) {
185 // TODO(paulberry): analyzer's ASTs allow for enumerated values to have 185 // TODO(paulberry): analyzer's ASTs allow for enumerated values to have
186 // metadata, but the spec doesn't permit it. 186 // metadata, but the spec doesn't permit it.
187 List<Annotation> metadata; 187 List<Annotation> metadata;
188 Comment comment = _toAnalyzerComment(token.precedingComments); 188 Comment comment = _toAnalyzerComment(token.precedingCommentTokens);
189 push(ast.enumConstantDeclaration(comment, metadata, identifier)); 189 push(ast.enumConstantDeclaration(comment, metadata, identifier));
190 } else { 190 } else {
191 if (context.isScopeReference) { 191 if (context.isScopeReference) {
192 String name = token.lexeme; 192 String name = token.lexeme;
193 Builder builder = scope.lookup(name, token.charOffset, uri); 193 Builder builder = scope.lookup(name, token.charOffset, uri);
194 if (builder != null) { 194 if (builder != null) {
195 Element element = elementStore[builder]; 195 Element element = elementStore[builder];
196 assert(element != null); 196 assert(element != null);
197 identifier.staticElement = element; 197 identifier.staticElement = element;
198 } 198 }
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 void handleOperatorName(Token operatorKeyword, Token token) { 1643 void handleOperatorName(Token operatorKeyword, Token token) {
1644 debugEvent("OperatorName"); 1644 debugEvent("OperatorName");
1645 push(new _OperatorName(operatorKeyword, 1645 push(new _OperatorName(operatorKeyword,
1646 ast.simpleIdentifier(toAnalyzerToken(token), isDeclaration: true))); 1646 ast.simpleIdentifier(toAnalyzerToken(token), isDeclaration: true)));
1647 } 1647 }
1648 1648
1649 @override 1649 @override
1650 void beginMetadataStar(Token token) { 1650 void beginMetadataStar(Token token) {
1651 debugEvent("beginMetadataStar"); 1651 debugEvent("beginMetadataStar");
1652 if (token.precedingComments != null) { 1652 if (token.precedingComments != null) {
1653 push(_toAnalyzerComment(token.precedingComments)); 1653 push(_toAnalyzerComment(token.precedingCommentTokens));
1654 } else { 1654 } else {
1655 push(NullValue.Comments); 1655 push(NullValue.Comments);
1656 } 1656 }
1657 } 1657 }
1658 1658
1659 @override 1659 @override
1660 void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) { 1660 void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) {
1661 debugEvent("Metadata"); 1661 debugEvent("Metadata");
1662 MethodInvocation invocation = pop(); 1662 MethodInvocation invocation = pop();
1663 SimpleIdentifier constructorName = periodBeforeName != null ? pop() : null; 1663 SimpleIdentifier constructorName = periodBeforeName != null ? pop() : null;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 } else if (identical('static', s)) { 1790 } else if (identical('static', s)) {
1791 staticKeyword = token; 1791 staticKeyword = token;
1792 } else if (identical('var', s)) { 1792 } else if (identical('var', s)) {
1793 finalConstOrVarKeyword = token; 1793 finalConstOrVarKeyword = token;
1794 } else { 1794 } else {
1795 internalError('Unhandled modifier: $s'); 1795 internalError('Unhandled modifier: $s');
1796 } 1796 }
1797 } 1797 }
1798 } 1798 }
1799 } 1799 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/fasta/token_utils.dart » ('j') | pkg/front_end/lib/src/fasta/scanner/token.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698