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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart

Issue 2829223007: Introduce initial plumbing for type promotion in fasta. (Closed)
Patch Set: Add missing copyrights Created 3 years, 8 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
Index: pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
index 54c6d36405444e6f331fed343315863f29a651a3..c6c863462a7869b91985c42ba02bda042137ef7a 100644
--- a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
@@ -141,17 +141,24 @@ abstract class Accessor {
makeInvalidWrite(Expression value) => wrapInvalid(value);
}
-class VariableAccessor extends Accessor {
+abstract class VariableAccessor extends Accessor {
VariableDeclaration variable;
DartType promotedType;
+ BuilderHelper get helper;
+
VariableAccessor(this.variable, this.promotedType, int offset)
: super(offset);
- Expression _makeRead() =>
- new VariableGet(variable, promotedType)..fileOffset = offset;
+ Expression _makeRead() {
+ var fact = helper.typePromoter
+ .getFactForAccess(variable, helper.functionNestingLevel);
+ var scope = helper.typePromoter.currentScope;
+ return helper.astFactory.variableGet(variable, fact, scope, offset);
+ }
Expression _makeWrite(Expression value, bool voidContext) {
+ helper.typePromoter.mutateVariable(variable, helper.functionNestingLevel);
return variable.isFinal || variable.isConst
? makeInvalidWrite(value)
: new VariableSet(variable, value)

Powered by Google App Engine
This is Rietveld 408576698