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

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

Issue 2763833002: fasta.CommentToken implement analyzer.CommentToken (Closed)
Patch Set: merge 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/fasta/token_utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (context.inLibraryOrPartOfDeclaration) { 181 if (context.inLibraryOrPartOfDeclaration) {
182 if (!context.isContinuation) { 182 if (!context.isContinuation) {
183 push([identifier]); 183 push([identifier]);
184 } else { 184 } else {
185 push(identifier); 185 push(identifier);
186 } 186 }
187 } else if (context == IdentifierContext.enumValueDeclaration) { 187 } else if (context == IdentifierContext.enumValueDeclaration) {
188 // TODO(paulberry): analyzer's ASTs allow for enumerated values to have 188 // TODO(paulberry): analyzer's ASTs allow for enumerated values to have
189 // metadata, but the spec doesn't permit it. 189 // metadata, but the spec doesn't permit it.
190 List<Annotation> metadata; 190 List<Annotation> metadata;
191 Comment comment = _toAnalyzerComment(token.precedingComments); 191 Comment comment = _toAnalyzerComment(token.precedingCommentTokens);
192 push(ast.enumConstantDeclaration(comment, metadata, identifier)); 192 push(ast.enumConstantDeclaration(comment, metadata, identifier));
193 } else { 193 } else {
194 if (context.isScopeReference) { 194 if (context.isScopeReference) {
195 String name = token.lexeme; 195 String name = token.lexeme;
196 Builder builder = scope.lookup(name, token.charOffset, uri); 196 Builder builder = scope.lookup(name, token.charOffset, uri);
197 if (builder != null) { 197 if (builder != null) {
198 Element element = elementStore[builder]; 198 Element element = elementStore[builder];
199 assert(element != null); 199 assert(element != null);
200 identifier.staticElement = element; 200 identifier.staticElement = element;
201 } 201 }
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 void handleOperatorName(Token operatorKeyword, Token token) { 1646 void handleOperatorName(Token operatorKeyword, Token token) {
1647 debugEvent("OperatorName"); 1647 debugEvent("OperatorName");
1648 push(new _OperatorName(operatorKeyword, 1648 push(new _OperatorName(operatorKeyword,
1649 ast.simpleIdentifier(toAnalyzerToken(token), isDeclaration: true))); 1649 ast.simpleIdentifier(toAnalyzerToken(token), isDeclaration: true)));
1650 } 1650 }
1651 1651
1652 @override 1652 @override
1653 void beginMetadataStar(Token token) { 1653 void beginMetadataStar(Token token) {
1654 debugEvent("beginMetadataStar"); 1654 debugEvent("beginMetadataStar");
1655 if (token.precedingComments != null) { 1655 if (token.precedingComments != null) {
1656 push(_toAnalyzerComment(token.precedingComments)); 1656 push(_toAnalyzerComment(token.precedingCommentTokens));
1657 } else { 1657 } else {
1658 push(NullValue.Comments); 1658 push(NullValue.Comments);
1659 } 1659 }
1660 } 1660 }
1661 1661
1662 @override 1662 @override
1663 void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) { 1663 void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) {
1664 debugEvent("Metadata"); 1664 debugEvent("Metadata");
1665 MethodInvocation invocation = pop(); 1665 MethodInvocation invocation = pop();
1666 SimpleIdentifier constructorName = periodBeforeName != null ? pop() : null; 1666 SimpleIdentifier constructorName = periodBeforeName != null ? pop() : null;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 } else if (identical('static', s)) { 1793 } else if (identical('static', s)) {
1794 staticKeyword = token; 1794 staticKeyword = token;
1795 } else if (identical('var', s)) { 1795 } else if (identical('var', s)) {
1796 finalConstOrVarKeyword = token; 1796 finalConstOrVarKeyword = token;
1797 } else { 1797 } else {
1798 internalError('Unhandled modifier: $s'); 1798 internalError('Unhandled modifier: $s');
1799 } 1799 }
1800 } 1800 }
1801 } 1801 }
1802 } 1802 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/fasta/token_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698