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

Unified Diff: lib/frontend/accessors.dart

Issue 2465263002: Always store the type of a conditional expression on the node. (Closed)
Patch Set: Update test expectation Created 4 years, 1 month 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 | « lib/ast.dart ('k') | lib/type_checker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/frontend/accessors.dart
diff --git a/lib/frontend/accessors.dart b/lib/frontend/accessors.dart
index 040836fa365b1b6c009730fb3e794487111579b9..fceec2f50c5267fa81008ff5f004ffdbd00f248b 100644
--- a/lib/frontend/accessors.dart
+++ b/lib/frontend/accessors.dart
@@ -21,17 +21,17 @@ abstract class Accessor {
return _finish(_makeSimpleWrite(value, voidContext));
}
- Expression buildNullAwareAssignment(Expression value,
+ Expression buildNullAwareAssignment(Expression value, DartType type,
{bool voidContext: false}) {
if (voidContext) {
return _finish(new ConditionalExpression(buildIsNull(_makeRead()),
- _makeWrite(value, voidContext), new NullLiteral()));
+ _makeWrite(value, voidContext), new NullLiteral(), type));
}
var tmp = new VariableDeclaration.forValue(_makeRead());
return _finish(makeLet(
tmp,
new ConditionalExpression(buildIsNull(new VariableGet(tmp)),
- _makeWrite(value, voidContext), new VariableGet(tmp))));
+ _makeWrite(value, voidContext), new VariableGet(tmp), type)));
}
Expression buildCompoundAssignment(Name binaryOperator, Expression value,
@@ -150,9 +150,10 @@ class NullAwarePropertyAccessor extends Accessor {
VariableDeclaration receiver;
Name name;
Member getter, setter;
+ DartType type;
NullAwarePropertyAccessor(
- Expression receiver, this.name, this.getter, this.setter)
+ Expression receiver, this.name, this.getter, this.setter, this.type)
: this.receiver = makeOrReuseVariable(receiver);
receiverAccess() => new VariableGet(receiver);
@@ -166,7 +167,7 @@ class NullAwarePropertyAccessor extends Accessor {
_finish(Expression body) => makeLet(
receiver,
new ConditionalExpression(
- buildIsNull(receiverAccess()), new NullLiteral(), body));
+ buildIsNull(receiverAccess()), new NullLiteral(), body, type));
}
class SuperPropertyAccessor extends Accessor {
« no previous file with comments | « lib/ast.dart ('k') | lib/type_checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698