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

Unified Diff: pkg/kernel/lib/text/ast_to_text.dart

Issue 2949753002: Print static types of conditional expressions. (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/testcases/void-methods.dart.strong.expect ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/text/ast_to_text.dart
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index cd42481da3670f8288a263807c63f4d178154cc1..2826c444986a0c15537c8a0975bd55335efa72d9 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -839,7 +839,10 @@ class Printer extends Visitor<Null> {
visitConditionalExpression(ConditionalExpression node) {
writeExpression(node.condition, Precedence.LOGICAL_OR);
- writeSpaced('?');
+ ensureSpace();
+ write('?');
+ writeStaticType(node.staticType);
+ writeSpace();
writeExpression(node.then);
writeSpaced(':');
writeExpression(node.otherwise);
@@ -1114,6 +1117,14 @@ class Printer extends Visitor<Null> {
}
}
+ void writeStaticType(DartType type) {
+ if (type != null) {
+ writeSymbol('{');
+ writeType(type);
+ writeSymbol('}');
+ }
+ }
+
visitPropertyGet(PropertyGet node) {
writeExpression(node.receiver, Precedence.PRIMARY);
writeSymbol('.');
« no previous file with comments | « pkg/front_end/testcases/void-methods.dart.strong.expect ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698