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

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

Issue 2647613004: Use entities in code_emitter_task (Closed)
Patch Set: Updated cf. comments 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
Index: pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
diff --git a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
index 3a7fd5458e9d2c4e3bb243140763e9b4e776c465..aa9bae04d8e14646961f99019d59e45760119691 100644
--- a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
+++ b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
@@ -10,14 +10,8 @@ import '../common.dart';
import '../common/tasks.dart' show CompilerTask;
import '../compiler.dart' show Compiler;
import '../constants/values.dart';
-import '../elements/elements.dart'
- show
- ClassElement,
- Entity,
- FieldElement,
- FunctionElement,
- MethodElement,
- TypeVariableElement;
+import '../elements/elements.dart' show Entity;
+import '../elements/entities.dart';
import '../js/js.dart' as jsAst;
import '../js_backend/js_backend.dart' show JavaScriptBackend, Namer;
import '../world.dart' show ClosedWorld;
@@ -47,8 +41,8 @@ class CodeEmitterTask extends CompilerTask {
final Compiler compiler;
/// Records if a type variable is read dynamically for type tests.
- final Set<TypeVariableElement> readTypeVariables =
- new Set<TypeVariableElement>();
+ final Set<TypeVariableEntity> readTypeVariables =
+ new Set<TypeVariableEntity>();
JavaScriptBackend get backend => compiler.backend;
@@ -57,7 +51,7 @@ class CodeEmitterTask extends CompilerTask {
// tests.
// The field is set after the program has been emitted.
/// Contains a list of all classes that are emitted.
- Set<ClassElement> neededClasses;
+ Set<ClassEntity> neededClasses;
CodeEmitterTask(
Compiler compiler, bool generateSourceMap, bool useStartupEmitter)
@@ -91,13 +85,13 @@ class CodeEmitterTask extends CompilerTask {
bool get supportsReflection => _emitterFactory.supportsReflection;
/// Returns the closure expression of a static function.
- jsAst.Expression isolateStaticClosureAccess(MethodElement element) {
+ jsAst.Expression isolateStaticClosureAccess(FunctionEntity element) {
return emitter.isolateStaticClosureAccess(element);
}
/// Returns the JS function that must be invoked to get the value of the
/// lazily initialized static.
- jsAst.Expression isolateLazyInitializerAccess(FieldElement element) {
+ jsAst.Expression isolateLazyInitializerAccess(FieldEntity element) {
return emitter.isolateLazyInitializerAccess(element);
}
@@ -111,37 +105,37 @@ class CodeEmitterTask extends CompilerTask {
return emitter.constantReference(constant);
}
- jsAst.Expression staticFieldAccess(FieldElement e) {
+ jsAst.Expression staticFieldAccess(FieldEntity e) {
return emitter.staticFieldAccess(e);
}
/// Returns the JS function representing the given function.
///
/// The function must be invoked and can not be used as closure.
- jsAst.Expression staticFunctionAccess(MethodElement e) {
+ jsAst.Expression staticFunctionAccess(FunctionEntity e) {
return emitter.staticFunctionAccess(e);
}
/// Returns the JS constructor of the given element.
///
/// The returned expression must only be used in a JS `new` expression.
- jsAst.Expression constructorAccess(ClassElement e) {
+ jsAst.Expression constructorAccess(ClassEntity e) {
return emitter.constructorAccess(e);
}
/// Returns the JS prototype of the given class [e].
- jsAst.Expression prototypeAccess(ClassElement e,
+ jsAst.Expression prototypeAccess(ClassEntity e,
{bool hasBeenInstantiated: false}) {
return emitter.prototypeAccess(e, hasBeenInstantiated);
}
/// Returns the JS prototype of the given interceptor class [e].
- jsAst.Expression interceptorPrototypeAccess(ClassElement e) {
+ jsAst.Expression interceptorPrototypeAccess(ClassEntity e) {
return jsAst.js('#.prototype', interceptorClassAccess(e));
}
/// Returns the JS constructor of the given interceptor class [e].
- jsAst.Expression interceptorClassAccess(ClassElement e) {
+ jsAst.Expression interceptorClassAccess(ClassEntity e) {
return emitter.interceptorClassAccess(e);
}
@@ -157,11 +151,11 @@ class CodeEmitterTask extends CompilerTask {
return emitter.templateForBuiltin(builtin);
}
- void registerReadTypeVariable(TypeVariableElement element) {
+ void registerReadTypeVariable(TypeVariableEntity element) {
readTypeVariables.add(element);
}
- Set<ClassElement> _finalizeRti() {
+ Set<ClassEntity> _finalizeRti() {
// Compute the required type checks to know which classes need a
// 'is$' method.
typeTestRegistry.computeRequiredTypeChecks();
@@ -182,7 +176,7 @@ class CodeEmitterTask extends CompilerTask {
return measure(() {
emitter.invalidateCaches();
- Set<ClassElement> rtiNeededClasses = _finalizeRti();
+ Set<ClassEntity> rtiNeededClasses = _finalizeRti();
ProgramBuilder programBuilder = new ProgramBuilder(
compiler, namer, this, emitter, closedWorld, rtiNeededClasses);
int size = emitter.emitProgram(programBuilder);
@@ -213,10 +207,10 @@ abstract class Emitter {
/// Returns the JS function that must be invoked to get the value of the
/// lazily initialized static.
- jsAst.Expression isolateLazyInitializerAccess(FieldElement element);
+ jsAst.Expression isolateLazyInitializerAccess(FieldEntity element);
/// Returns the closure expression of a static function.
- jsAst.Expression isolateStaticClosureAccess(FunctionElement element);
+ jsAst.Expression isolateStaticClosureAccess(FunctionEntity element);
/// Returns the JS code for accessing the embedded [global].
jsAst.Expression generateEmbeddedGlobalAccess(String global);
@@ -224,20 +218,20 @@ abstract class Emitter {
/// Returns the JS function representing the given function.
///
/// The function must be invoked and can not be used as closure.
- jsAst.Expression staticFunctionAccess(FunctionElement element);
+ jsAst.Expression staticFunctionAccess(FunctionEntity element);
- jsAst.Expression staticFieldAccess(FieldElement element);
+ jsAst.Expression staticFieldAccess(FieldEntity element);
/// Returns the JS constructor of the given element.
///
/// The returned expression must only be used in a JS `new` expression.
- jsAst.Expression constructorAccess(ClassElement e);
+ jsAst.Expression constructorAccess(ClassEntity e);
/// Returns the JS prototype of the given class [e].
- jsAst.Expression prototypeAccess(ClassElement e, bool hasBeenInstantiated);
+ jsAst.Expression prototypeAccess(ClassEntity e, bool hasBeenInstantiated);
/// Returns the JS constructor of the given interceptor class [e].
- jsAst.Expression interceptorClassAccess(ClassElement e);
+ jsAst.Expression interceptorClassAccess(ClassEntity e);
/// Returns the JS expression representing the type [e].
jsAst.Expression typeAccess(Entity e);
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698