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

Unified Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2619683002: dart2js-kernel: do not initialize static fields in constructor (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 1ab19ec36e4760693a82839af6baf454e44bf46e..013ef4be68741a32f025b15a4e042afc1ef59ed0 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -290,20 +290,22 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
closeFunction();
}
- /// Maps the fields of a class to their SSA values.
+ /// Maps the instance fields of a class to their SSA values.
Map<ir.Field, HInstruction> _collectFieldValues(ir.Class clazz) {
final fieldValues = <ir.Field, HInstruction>{};
for (var field in clazz.fields) {
- if (field.initializer == null) {
- fieldValues[field] = graph.addConstantNull(closedWorld);
- } else {
- // Gotta update the resolvedAst when we're looking at field values
- // outside the constructor.
- astAdapter.pushResolvedAst(field);
- field.initializer.accept(this);
- fieldValues[field] = pop();
- astAdapter.popResolvedAstStack();
+ if (field.isInstanceMember) {
+ if (field.initializer == null) {
+ fieldValues[field] = graph.addConstantNull(closedWorld);
+ } else {
+ // Gotta update the resolvedAst when we're looking at field values
+ // outside the constructor.
+ astAdapter.pushResolvedAst(field);
+ field.initializer.accept(this);
+ fieldValues[field] = pop();
+ astAdapter.popResolvedAstStack();
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698