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

Unified Diff: pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart

Issue 2863073003: Access NativeData only through ClosedWorld (Closed)
Patch Set: Created 3 years, 7 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/full_emitter/emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
index 32410469946abab959f8abf4c8cd60455680f472..7359c7f86ec00911e735ecc6fc2173a1020202a2 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
@@ -44,6 +44,7 @@ import '../../js_backend/js_backend.dart'
Namer,
SetterName,
TypeVariableCodegenAnalysis;
+import '../../js_backend/native_data.dart';
import '../../universe/call_structure.dart' show CallStructure;
import '../../universe/selector.dart' show Selector;
import '../../universe/world_builder.dart' show CodegenWorldBuilder;
@@ -93,6 +94,7 @@ class EmitterFactory implements js_emitter.EmitterFactory {
class Emitter implements js_emitter.Emitter {
final Compiler compiler;
final CodeEmitterTask task;
+ final ClosedWorld _closedWorld;
// The following fields will be set to copies of the program-builder's
// collector.
@@ -171,13 +173,11 @@ class Emitter implements js_emitter.Emitter {
final bool generateSourceMap;
- Emitter(Compiler compiler, Namer namer, ClosedWorld closedWorld,
- this.generateSourceMap, this.task, this._sorter)
- : this.compiler = compiler,
- this.namer = namer,
- classEmitter = new ClassEmitter(closedWorld),
- interceptorEmitter = new InterceptorEmitter(closedWorld),
- nsmEmitter = new NsmEmitter(closedWorld) {
+ Emitter(this.compiler, this.namer, this._closedWorld, this.generateSourceMap,
+ this.task, this._sorter)
+ : classEmitter = new ClassEmitter(_closedWorld),
+ interceptorEmitter = new InterceptorEmitter(_closedWorld),
+ nsmEmitter = new NsmEmitter(_closedWorld) {
constantEmitter = new ConstantEmitter(
compiler, namer, this.constantReference, constantListGenerator);
containerBuilder.emitter = this;
@@ -188,6 +188,8 @@ class Emitter implements js_emitter.Emitter {
DiagnosticReporter get reporter => compiler.reporter;
+ NativeData get _nativeData => _closedWorld.nativeData;
+
List<jsAst.Node> cspPrecompiledFunctionFor(OutputUnit outputUnit) {
return _cspPrecompiledFunctions.putIfAbsent(
outputUnit, () => new List<jsAst.Node>());
@@ -1648,14 +1650,14 @@ class Emitter implements js_emitter.Emitter {
ClassBuilder getStaticMethodDescriptor(
MethodElement element, Fragment fragment) {
Element owner = element.library;
- if (!backend.nativeData.isNativeMember(element)) {
+ if (!_nativeData.isNativeMember(element)) {
// For static (not top level) elements, record their code in a buffer
// specific to the class. For now, not supported for native classes and
// native elements.
ClassElement cls = element.enclosingClass;
if (compiler.codegenWorldBuilder.directlyInstantiatedClasses
.contains(cls) &&
- !backend.nativeData.isNativeClass(cls) &&
+ !_nativeData.isNativeClass(cls) &&
compiler.deferredLoadTask.outputUnitForElement(element) ==
compiler.deferredLoadTask.outputUnitForElement(cls)) {
owner = cls;

Powered by Google App Engine
This is Rietveld 408576698