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

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

Issue 2742403002: fix fasta summary builder (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
« no previous file with comments | « pkg/analyzer/lib/src/summary/fasta/stack_listener.dart ('k') | no next file » | 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) 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/class_member_parser.dart'; 8 import 'package:front_end/src/fasta/parser/class_member_parser.dart';
9 import 'package:front_end/src/fasta/parser/identifier_context.dart'; 9 import 'package:front_end/src/fasta/parser/identifier_context.dart';
10 import 'package:front_end/src/fasta/parser/parser.dart'; 10 import 'package:front_end/src/fasta/parser/parser.dart';
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 void handleIsOperator(Token operator, Token not, Token endToken) { 427 void handleIsOperator(Token operator, Token not, Token endToken) {
428 debugEvent("Is"); 428 debugEvent("Is");
429 if (ignore) return; 429 if (ignore) return;
430 push(new Is(pop(), pop())); 430 push(new Is(pop(), pop()));
431 } 431 }
432 432
433 void handleLiteralBool(Token token) { 433 void handleLiteralBool(Token token) {
434 debugEvent("LiteralBool"); 434 debugEvent("LiteralBool");
435 if (ignore) return; 435 if (ignore) return;
436 push(new BoolLiteral(token.value == 'true')); 436 push(new BoolLiteral(token.lexeme == 'true'));
437 } 437 }
438 438
439 void handleLiteralDouble(Token token) { 439 void handleLiteralDouble(Token token) {
440 debugEvent("LiteralDouble"); 440 debugEvent("LiteralDouble");
441 if (ignore) return; 441 if (ignore) return;
442 push(new DoubleLiteral(double.parse(token.lexeme))); 442 push(new DoubleLiteral(double.parse(token.lexeme)));
443 } 443 }
444 444
445 void handleLiteralInt(Token token) { 445 void handleLiteralInt(Token token) {
446 debugEvent("LiteralInt"); 446 debugEvent("LiteralInt");
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 584
585 // debug helpers 585 // debug helpers
586 586
587 void _endFunction(); 587 void _endFunction();
588 588
589 void _printExpression(Token token) { 589 void _printExpression(Token token) {
590 var current = token; 590 var current = token;
591 var end = new ClassMemberParser(this).skipExpression(current); 591 var end = new ClassMemberParser(this).skipExpression(current);
592 var str = new StringBuffer(); 592 var str = new StringBuffer();
593 while (current != end) { 593 while (current != end) {
594 if (!["(", ",", ")"].contains(current.value)) str.write(' '); 594 if (!["(", ",", ")"].contains(current.lexeme)) str.write(' ');
595 str.write(current.value); 595 str.write(current.lexeme);
596 current = current.next; 596 current = current.next;
597 } 597 }
598 print('exp: $str'); 598 print('exp: $str');
599 } 599 }
600 600
601 void _unhandledSend(); 601 void _unhandledSend();
602 } 602 }
603 603
604 /// Builder for initializer expressions. These expressions exclude any nested 604 /// Builder for initializer expressions. These expressions exclude any nested
605 /// expression that is not needed to infer strong mode types. 605 /// expression that is not needed to infer strong mode types.
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 } 1459 }
1460 1460
1461 void handleNoTypeVariables(Token token) { 1461 void handleNoTypeVariables(Token token) {
1462 debugEvent("NoTypeVariables"); 1462 debugEvent("NoTypeVariables");
1463 push(const []); 1463 push(const []);
1464 } 1464 }
1465 1465
1466 void handleOperatorName(Token operatorKeyword, Token token) { 1466 void handleOperatorName(Token operatorKeyword, Token token) {
1467 // TODO(sigmund): convert operator names to name used by summaries. 1467 // TODO(sigmund): convert operator names to name used by summaries.
1468 debugEvent("OperatorName"); 1468 debugEvent("OperatorName");
1469 push(operatorKeyword.value); 1469 push(operatorKeyword.lexeme);
1470 } 1470 }
1471 1471
1472 void handleQualified(Token period) { 1472 void handleQualified(Token period) {
1473 debugEvent("handleQualified"); 1473 debugEvent("handleQualified");
1474 String name = pop(); 1474 String name = pop();
1475 String receiver = pop(); 1475 String receiver = pop();
1476 push("$receiver.$name"); 1476 push("$receiver.$name");
1477 } 1477 }
1478 1478
1479 void handleStringPart(token) { 1479 void handleStringPart(token) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 } 1590 }
1591 1591
1592 /// Internal representation of an initialized name. 1592 /// Internal representation of an initialized name.
1593 class _InitializedName { 1593 class _InitializedName {
1594 final String name; 1594 final String name;
1595 final UnlinkedExecutableBuilder initializer; 1595 final UnlinkedExecutableBuilder initializer;
1596 _InitializedName(this.name, this.initializer); 1596 _InitializedName(this.name, this.initializer);
1597 1597
1598 toString() => "II:" + (initializer != null ? "$name = $initializer" : name); 1598 toString() => "II:" + (initializer != null ? "$name = $initializer" : name);
1599 } 1599 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/fasta/stack_listener.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698