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

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

Issue 2968093003: Improve parsing of function expressions. (Closed)
Patch Set: Created 3 years, 5 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 /// Logic to build unlinked summaries. 5 /// Logic to build unlinked summaries.
6 library summary.src.summary_builder; 6 library summary.src.summary_builder;
7 7
8 import 'package:front_end/src/fasta/parser.dart' 8 import 'package:front_end/src/fasta/parser.dart'
9 show 9 show
10 ClassMemberParser, 10 ClassMemberParser,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 debugEvent("BeginFunctionDeclaration"); 211 debugEvent("BeginFunctionDeclaration");
212 _withinFunction++; 212 _withinFunction++;
213 } 213 }
214 214
215 void beginLiteralString(Token token) { 215 void beginLiteralString(Token token) {
216 debugEvent("beginLiteralString"); 216 debugEvent("beginLiteralString");
217 if (ignore) return; 217 if (ignore) return;
218 push(new StringLiteral(token.lexeme)); 218 push(new StringLiteral(token.lexeme));
219 } 219 }
220 220
221 void beginUnnamedFunction(token) { 221 @override
222 debugEvent("BeginUnnamedFunction"); 222 void beginFunctionExpression(token) {
223 debugEvent("beginFunctionExpression");
223 var check = pop(); 224 var check = pop();
224 assert(check == _invariantCheckToken); 225 assert(check == _invariantCheckToken);
225 _withinFunction++; 226 _withinFunction++;
226 } 227 }
227 228
228 UnlinkedExprBuilder computeExpression(Token token, Scope scope) { 229 UnlinkedExprBuilder computeExpression(Token token, Scope scope) {
229 debugStart(token); 230 debugStart(token);
230 parser.parseExpression(token); 231 parser.parseExpression(token);
231 debugEvent('---- END ---'); 232 debugEvent('---- END ---');
232 Expression node = pop(); 233 Expression node = pop();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 int count, Token beginToken, Token endToken, MemberKind kind) { 279 int count, Token beginToken, Token endToken, MemberKind kind) {
279 debugEvent("FormalParameters"); 280 debugEvent("FormalParameters");
280 assert(ignore); 281 assert(ignore);
281 } 282 }
282 283
283 void endBlockFunctionBody(int count, Token begin, Token end) { 284 void endBlockFunctionBody(int count, Token begin, Token end) {
284 debugEvent("BlockFunctionBody"); 285 debugEvent("BlockFunctionBody");
285 assert(ignore); 286 assert(ignore);
286 } 287 }
287 288
288 void endFunctionDeclaration(token) { 289 void endFunctionDeclaration(Token endToken) {
289 debugEvent("FunctionDeclaration"); 290 debugEvent("FunctionDeclaration");
290 _withinFunction--; 291 _withinFunction--;
291 if (ignore) return; 292 if (ignore) return;
292 _endFunction(); 293 _endFunction();
293 } 294 }
294 295
295 void endFunctionName(Token beginToken, Token token) { 296 void endFunctionName(Token beginToken, Token token) {
296 debugEvent("FunctionName"); 297 debugEvent("FunctionName");
297 assert(ignore); 298 assert(ignore);
298 } 299 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 void endTypeVariable(Token token, Token extendsOrSuper) { 364 void endTypeVariable(Token token, Token extendsOrSuper) {
364 debugEvent("endTypeVariable"); 365 debugEvent("endTypeVariable");
365 assert(ignore); 366 assert(ignore);
366 } 367 }
367 368
368 void endTypeVariables(int count, Token beginToken, Token endToken) { 369 void endTypeVariables(int count, Token beginToken, Token endToken) {
369 debugEvent("TypeVariables"); 370 debugEvent("TypeVariables");
370 assert(ignore); 371 assert(ignore);
371 } 372 }
372 373
373 void endUnnamedFunction(Token beginToken, Token token) { 374 void endFunctionExpression(Token beginToken, Token token) {
danrubel 2017/07/06 15:43:34 @override ?
ahe 2017/07/06 19:54:18 Done.
374 debugEvent("UnnamedFunction"); 375 debugEvent("FunctionExpression");
375 _withinFunction--; 376 _withinFunction--;
376 if (ignore) return; 377 if (ignore) return;
377 _endFunction(); 378 _endFunction();
378 } 379 }
379 380
380 void handleAsyncModifier(Token asyncToken, Token starToken) { 381 void handleAsyncModifier(Token asyncToken, Token starToken) {
381 debugEvent("AsyncModifier"); 382 debugEvent("AsyncModifier");
382 assert(ignore); 383 assert(ignore);
383 } 384 }
384 385
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 } 1560 }
1560 1561
1561 /// Internal representation of an initialized name. 1562 /// Internal representation of an initialized name.
1562 class _InitializedName { 1563 class _InitializedName {
1563 final String name; 1564 final String name;
1564 final UnlinkedExecutableBuilder initializer; 1565 final UnlinkedExecutableBuilder initializer;
1565 _InitializedName(this.name, this.initializer); 1566 _InitializedName(this.name, this.initializer);
1566 1567
1567 toString() => "II:" + (initializer != null ? "$name = $initializer" : name); 1568 toString() => "II:" + (initializer != null ? "$name = $initializer" : name);
1568 } 1569 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698