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

Unified Diff: pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart

Issue 1233263003: dart2js: add isConstantsHolder to Holder class. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments. Created 5 years, 5 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/compiler/lib/src/js_emitter/program_builder/program_builder.dart
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index d41b5e499dd4694bcabe716ff843cfda1b6b3bd0..a526b4813b03469f451cc6831f12e495f308e072 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -100,8 +100,7 @@ class ProgramBuilder {
_registry.registerElements);
// We always add the current isolate holder.
- _registry.registerHolder(
- namer.staticStateHolder, isStaticStateHolder: true);
+ _registerStaticStateHolder();
// We need to run the native-preparation before we build the output. The
// preparation code, in turn needs the classes to be set up.
@@ -251,17 +250,19 @@ class ProgramBuilder {
ConstantValue initialValue = handler.getInitialValueFor(element);
// TODO(zarah): The holder should not be registered during building of
// a static field.
- _registry.registerHolder(namer.globalObjectForConstant(initialValue));
+ _registry.registerHolder(
+ namer.globalObjectForConstant(initialValue), isConstantsHolder: true);
js.Expression code = _task.emitter.constantReference(initialValue);
js.Name name = namer.globalPropertyName(element);
bool isFinal = false;
bool isLazy = false;
// TODO(floitsch): we shouldn't update the registry in the middle of
- // building a static field. (Note that the $ holder is already registered
- // earlier).
+ // building a static field. (Note that the static-state holder was
+ // already registered earlier, and that we just call the register to get
+ // the holder-instance.
return new StaticField(element,
- name, _registry.registerHolder(r'$'), code,
+ name, _registerStaticStateHolder(), code,
isFinal, isLazy);
}
@@ -293,10 +294,11 @@ class ProgramBuilder {
bool isFinal = element.isFinal;
bool isLazy = true;
// TODO(floitsch): we shouldn't update the registry in the middle of
- // building a static field. (Note that the $ holder is already registered
- // earlier).
+ // building a static field. (Note that the static-state holder was
+ // already registered earlier, and that we just call the register to get
+ // the holder-instance.
return new StaticField(element,
- name, _registry.registerHolder(r'$'), code,
+ name, _registerStaticStateHolder(), code,
isFinal, isLazy);
}
@@ -793,9 +795,15 @@ class ProgramBuilder {
assert(!_constants.containsKey(constantValue));
js.Name name = namer.constantName(constantValue);
String constantObject = namer.globalObjectForConstant(constantValue);
- Holder holder = _registry.registerHolder(constantObject);
+ Holder holder =
+ _registry.registerHolder(constantObject, isConstantsHolder: true);
Constant constant = new Constant(name, holder, constantValue);
_constants[constantValue] = constant;
}
}
+
+ Holder _registerStaticStateHolder() {
+ return _registry.registerHolder(
+ namer.staticStateHolder, isStaticStateHolder: true);
+ }
}
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/model.dart ('k') | pkg/compiler/lib/src/js_emitter/program_builder/registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698