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

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

Issue 2746013003: [fasta] Add and correct even more offsets (Closed)
Patch Set: Removed formalParametersToken parameter 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/summary/fasta/summary_builder.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;
11 import 'package:analyzer/dart/element/element.dart' show Element; 11 import 'package:analyzer/dart/element/element.dart' show Element;
12 import 'package:front_end/src/fasta/parser/parser.dart' show FormalParameterType ; 12 import 'package:front_end/src/fasta/parser/parser.dart'
13 import 'package:front_end/src/fasta/scanner/token.dart' show BeginGroupToken, To ken; 13 show FormalParameterType;
14 import 'package:front_end/src/fasta/scanner/token.dart'
15 show BeginGroupToken, Token;
14 16
15 import 'package:front_end/src/fasta/errors.dart' show internalError; 17 import 'package:front_end/src/fasta/errors.dart' show internalError;
16 import 'package:front_end/src/fasta/kernel/kernel_builder.dart' 18 import 'package:front_end/src/fasta/kernel/kernel_builder.dart'
17 show Builder, KernelLibraryBuilder, ProcedureBuilder; 19 show Builder, KernelLibraryBuilder, ProcedureBuilder;
18 import 'package:front_end/src/fasta/parser/identifier_context.dart' show Identif ierContext; 20 import 'package:front_end/src/fasta/parser/identifier_context.dart'
21 show IdentifierContext;
19 import 'package:front_end/src/fasta/quote.dart'; 22 import 'package:front_end/src/fasta/quote.dart';
20 import 'package:front_end/src/fasta/source/scope_listener.dart' 23 import 'package:front_end/src/fasta/source/scope_listener.dart'
21 show JumpTargetKind, NullValue, Scope, ScopeListener; 24 show JumpTargetKind, NullValue, Scope, ScopeListener;
22 import 'analyzer.dart' show toKernel; 25 import 'analyzer.dart' show toKernel;
23 import 'element_store.dart' 26 import 'element_store.dart'
24 show 27 show
25 AnalyzerLocalVariableElemment, 28 AnalyzerLocalVariableElemment,
26 AnalyzerParameterElement, 29 AnalyzerParameterElement,
27 ElementStore, 30 ElementStore,
28 KernelClassElement; 31 KernelClassElement;
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 variableList.keyword, 750 variableList.keyword,
748 variableList.type, 751 variableList.type,
749 variableList.variables.single.name), 752 variableList.variables.single.name),
750 toAnalyzerToken(inKeyword), 753 toAnalyzerToken(inKeyword),
751 iterator, 754 iterator,
752 toAnalyzerToken(rightParenthesis), 755 toAnalyzerToken(rightParenthesis),
753 body)); 756 body));
754 } 757 }
755 } 758 }
756 759
757 void endFormalParameter( 760 void endFormalParameter(Token covariantKeyword, Token thisKeyword,
758 Token covariantKeyword, Token thisKeyword, FormalParameterType kind) { 761 Token nameToken, FormalParameterType kind) {
759 debugEvent("FormalParameter"); 762 debugEvent("FormalParameter");
760 _ParameterDefaultValue defaultValue = pop(); 763 _ParameterDefaultValue defaultValue = pop();
761 764
762 AstNode nameOrFunctionTypedParameter = pop(); 765 AstNode nameOrFunctionTypedParameter = pop();
763 766
764 FormalParameter node; 767 FormalParameter node;
765 SimpleIdentifier name; 768 SimpleIdentifier name;
766 if (nameOrFunctionTypedParameter is FormalParameter) { 769 if (nameOrFunctionTypedParameter is FormalParameter) {
767 node = nameOrFunctionTypedParameter; 770 node = nameOrFunctionTypedParameter;
768 name = nameOrFunctionTypedParameter.identifier; 771 name = nameOrFunctionTypedParameter.identifier;
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 StringLiteral uri = null; // TODO(paulberry) 1335 StringLiteral uri = null; // TODO(paulberry)
1333 // TODO(paulberry,ahe): seems hacky. It would be nice if the parser passed 1336 // TODO(paulberry,ahe): seems hacky. It would be nice if the parser passed
1334 // in a reference to the "of" keyword. 1337 // in a reference to the "of" keyword.
1335 var ofKeyword = partKeyword.next; 1338 var ofKeyword = partKeyword.next;
1336 List<Annotation> metadata = pop(); 1339 List<Annotation> metadata = pop();
1337 Comment comment = pop(); 1340 Comment comment = pop();
1338 push(ast.partOfDirective(comment, metadata, toAnalyzerToken(partKeyword), 1341 push(ast.partOfDirective(comment, metadata, toAnalyzerToken(partKeyword),
1339 toAnalyzerToken(ofKeyword), uri, name, toAnalyzerToken(semicolon))); 1342 toAnalyzerToken(ofKeyword), uri, name, toAnalyzerToken(semicolon)));
1340 } 1343 }
1341 1344
1342 void endUnnamedFunction(Token token) { 1345 void endUnnamedFunction(Token beginToken, Token token) {
1343 // TODO(paulberry): set up scopes properly to resolve parameters and type 1346 // TODO(paulberry): set up scopes properly to resolve parameters and type
1344 // variables. Note that this is tricky due to the handling of initializers 1347 // variables. Note that this is tricky due to the handling of initializers
1345 // in constructors, so the logic should be shared with BodyBuilder as much 1348 // in constructors, so the logic should be shared with BodyBuilder as much
1346 // as possible. 1349 // as possible.
1347 debugEvent("UnnamedFunction"); 1350 debugEvent("UnnamedFunction");
1348 FunctionBody body = pop(); 1351 FunctionBody body = pop();
1349 FormalParameterList parameters = pop(); 1352 FormalParameterList parameters = pop();
1350 TypeParameterList typeParameters = pop(); 1353 TypeParameterList typeParameters = pop();
1351 push(ast.functionExpression(typeParameters, parameters, body)); 1354 push(ast.functionExpression(typeParameters, parameters, body));
1352 } 1355 }
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 } else if (identical('static', s)) { 1793 } else if (identical('static', s)) {
1791 staticKeyword = token; 1794 staticKeyword = token;
1792 } else if (identical('var', s)) { 1795 } else if (identical('var', s)) {
1793 finalConstOrVarKeyword = token; 1796 finalConstOrVarKeyword = token;
1794 } else { 1797 } else {
1795 internalError('Unhandled modifier: $s'); 1798 internalError('Unhandled modifier: $s');
1796 } 1799 }
1797 } 1800 }
1798 } 1801 }
1799 } 1802 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/fasta/summary_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698