mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Add ClosedWorld.elementEnvironment and remove Compiler.elementEnvironment
R=efortuna@google.com Review-Url: https://codereview.chromium.org/2935063002 .
This commit is contained in:
parent
5afe65e891
commit
ea070c7264
24 changed files with 96 additions and 66 deletions
|
@ -8,7 +8,7 @@ import '../common.dart';
|
|||
import '../compile_time_constants.dart';
|
||||
import '../constants/expressions.dart' show ConstantExpression;
|
||||
import '../constants/values.dart' show ConstantValue;
|
||||
import '../common_elements.dart' show CommonElements;
|
||||
import '../common_elements.dart' show CommonElements, ElementEnvironment;
|
||||
import '../elements/resolution_types.dart' show ResolutionDartType, Types;
|
||||
import '../elements/elements.dart'
|
||||
show
|
||||
|
@ -122,6 +122,7 @@ abstract class Target {
|
|||
abstract class Resolution {
|
||||
ParsingContext get parsingContext;
|
||||
DiagnosticReporter get reporter;
|
||||
ElementEnvironment get elementEnvironment;
|
||||
CommonElements get commonElements;
|
||||
Types get types;
|
||||
Target get target;
|
||||
|
|
|
@ -88,7 +88,6 @@ abstract class Compiler {
|
|||
DartTypes types;
|
||||
FrontendStrategy frontendStrategy;
|
||||
BackendStrategy backendStrategy;
|
||||
ElementEnvironment _elementEnvironment;
|
||||
CompilerDiagnosticReporter _reporter;
|
||||
CompilerResolution _resolution;
|
||||
ParsingContext _parsingContext;
|
||||
|
@ -120,7 +119,6 @@ abstract class Compiler {
|
|||
FunctionEntity mainFunction;
|
||||
|
||||
DiagnosticReporter get reporter => _reporter;
|
||||
ElementEnvironment get elementEnvironment => _elementEnvironment;
|
||||
Resolution get resolution => _resolution;
|
||||
ParsingContext get parsingContext => _parsingContext;
|
||||
|
||||
|
@ -200,7 +198,6 @@ abstract class Compiler {
|
|||
? new KernelBackendStrategy(this)
|
||||
: new ElementBackendStrategy(this);
|
||||
_resolution = createResolution();
|
||||
_elementEnvironment = frontendStrategy.elementEnvironment;
|
||||
types = new Types(_resolution);
|
||||
|
||||
if (options.verbose) {
|
||||
|
@ -568,7 +565,8 @@ abstract class Compiler {
|
|||
}
|
||||
reporter.log('Resolving...');
|
||||
|
||||
processQueue(resolutionEnqueuer, mainFunction, libraryLoader.libraries,
|
||||
processQueue(frontendStrategy.elementEnvironment, resolutionEnqueuer,
|
||||
mainFunction, libraryLoader.libraries,
|
||||
onProgress: showResolutionProgress);
|
||||
backend.onResolutionEnd();
|
||||
resolutionEnqueuer.logSummary(reporter.log);
|
||||
|
@ -621,7 +619,8 @@ abstract class Compiler {
|
|||
codegenEnqueuer.applyImpact(computeImpactForLibrary(library));
|
||||
});
|
||||
}
|
||||
processQueue(codegenEnqueuer, mainFunction, libraryLoader.libraries,
|
||||
processQueue(closedWorld.elementEnvironment, codegenEnqueuer,
|
||||
mainFunction, libraryLoader.libraries,
|
||||
onProgress: showCodegenProgress);
|
||||
codegenEnqueuer.logSummary(reporter.log);
|
||||
|
||||
|
@ -744,8 +743,8 @@ abstract class Compiler {
|
|||
});
|
||||
}
|
||||
|
||||
void processQueue(Enqueuer enqueuer, FunctionEntity mainMethod,
|
||||
Iterable<LibraryEntity> libraries,
|
||||
void processQueue(ElementEnvironment elementEnvironment, Enqueuer enqueuer,
|
||||
FunctionEntity mainMethod, Iterable<LibraryEntity> libraries,
|
||||
{void onProgress(Enqueuer enqueuer)}) {
|
||||
selfTask.measureSubtask("Compiler.processQueue", () {
|
||||
enqueuer.open(impactStrategy, mainMethod, libraries);
|
||||
|
@ -1295,6 +1294,10 @@ class CompilerResolution implements Resolution {
|
|||
@override
|
||||
ParsingContext get parsingContext => _compiler.parsingContext;
|
||||
|
||||
@override
|
||||
ElementEnvironment get elementEnvironment =>
|
||||
_compiler.frontendStrategy.elementEnvironment;
|
||||
|
||||
@override
|
||||
CommonElements get commonElements =>
|
||||
_compiler.frontendStrategy.commonElements;
|
||||
|
|
|
@ -15,7 +15,7 @@ import '../compiler.dart' show Compiler;
|
|||
import '../constants/constant_system.dart';
|
||||
import '../constants/expressions.dart';
|
||||
import '../constants/values.dart';
|
||||
import '../common_elements.dart' show CommonElements;
|
||||
import '../common_elements.dart' show CommonElements, ElementEnvironment;
|
||||
import '../deferred_load.dart' show DeferredLoadTask;
|
||||
import '../dump_info.dart' show DumpInfoTask;
|
||||
import '../elements/elements.dart';
|
||||
|
@ -452,8 +452,10 @@ class JavaScriptBackend {
|
|||
bool useNewSourceInfo: false,
|
||||
bool useKernel: false})
|
||||
: _rti = new RuntimeTypesImpl(
|
||||
compiler.elementEnvironment, compiler.frontendStrategy.dartTypes),
|
||||
optimizerHints = new OptimizerHintsForTests(compiler.elementEnvironment,
|
||||
compiler.frontendStrategy.elementEnvironment,
|
||||
compiler.frontendStrategy.dartTypes),
|
||||
optimizerHints = new OptimizerHintsForTests(
|
||||
compiler.frontendStrategy.elementEnvironment,
|
||||
compiler.frontendStrategy.commonElements),
|
||||
this.sourceInformationStrategy =
|
||||
compiler.backendStrategy.sourceInformationStrategy,
|
||||
|
@ -471,12 +473,14 @@ class JavaScriptBackend {
|
|||
new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter);
|
||||
|
||||
_typeVariableResolutionAnalysis = new TypeVariableResolutionAnalysis(
|
||||
compiler.elementEnvironment, impacts, _backendUsageBuilder);
|
||||
compiler.frontendStrategy.elementEnvironment,
|
||||
impacts,
|
||||
_backendUsageBuilder);
|
||||
jsInteropAnalysis = new JsInteropAnalysis(this);
|
||||
_mirrorsResolutionAnalysis =
|
||||
compiler.frontendStrategy.createMirrorsResolutionAnalysis(this);
|
||||
lookupMapResolutionAnalysis =
|
||||
new LookupMapResolutionAnalysis(reporter, compiler.elementEnvironment);
|
||||
lookupMapResolutionAnalysis = new LookupMapResolutionAnalysis(
|
||||
reporter, compiler.frontendStrategy.elementEnvironment);
|
||||
|
||||
noSuchMethodRegistry = new NoSuchMethodRegistry(
|
||||
commonElements, compiler.frontendStrategy.createNoSuchMethodResolver());
|
||||
|
@ -732,7 +736,7 @@ class JavaScriptBackend {
|
|||
ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) {
|
||||
for (MemberEntity entity
|
||||
in compiler.enqueuer.resolution.processedEntities) {
|
||||
processAnnotations(
|
||||
processAnnotations(closedWorld.elementEnvironment,
|
||||
closedWorld.commonElements, entity, closedWorldRefiner);
|
||||
}
|
||||
mirrorsDataBuilder.computeMembersNeededForReflection(
|
||||
|
@ -781,12 +785,13 @@ class JavaScriptBackend {
|
|||
|
||||
ResolutionEnqueuer createResolutionEnqueuer(
|
||||
CompilerTask task, Compiler compiler) {
|
||||
ElementEnvironment elementEnvironment =
|
||||
compiler.frontendStrategy.elementEnvironment;
|
||||
CommonElements commonElements = compiler.frontendStrategy.commonElements;
|
||||
_nativeBasicData =
|
||||
nativeBasicDataBuilder.close(compiler.elementEnvironment);
|
||||
_nativeBasicData = nativeBasicDataBuilder.close(elementEnvironment);
|
||||
_nativeResolutionEnqueuer = new native.NativeResolutionEnqueuer(
|
||||
compiler.options,
|
||||
compiler.elementEnvironment,
|
||||
elementEnvironment,
|
||||
commonElements,
|
||||
compiler.frontendStrategy.dartTypes,
|
||||
_backendUsageBuilder,
|
||||
|
@ -794,13 +799,13 @@ class JavaScriptBackend {
|
|||
_nativeDataBuilder = new NativeDataBuilderImpl(nativeBasicData);
|
||||
_customElementsResolutionAnalysis = new CustomElementsResolutionAnalysis(
|
||||
constantSystem,
|
||||
compiler.elementEnvironment,
|
||||
elementEnvironment,
|
||||
commonElements,
|
||||
nativeBasicData,
|
||||
_backendUsageBuilder);
|
||||
impactTransformer = new JavaScriptImpactTransformer(
|
||||
compiler.options,
|
||||
compiler.elementEnvironment,
|
||||
elementEnvironment,
|
||||
commonElements,
|
||||
impacts,
|
||||
nativeBasicData,
|
||||
|
@ -811,7 +816,7 @@ class JavaScriptBackend {
|
|||
rtiNeedBuilder);
|
||||
InterceptorDataBuilder interceptorDataBuilder =
|
||||
new InterceptorDataBuilderImpl(
|
||||
nativeBasicData, compiler.elementEnvironment, commonElements);
|
||||
nativeBasicData, elementEnvironment, commonElements);
|
||||
return new ResolutionEnqueuer(
|
||||
task,
|
||||
compiler.options,
|
||||
|
@ -821,7 +826,7 @@ class JavaScriptBackend {
|
|||
: const TreeShakingEnqueuerStrategy(),
|
||||
new ResolutionEnqueuerListener(
|
||||
compiler.options,
|
||||
compiler.elementEnvironment,
|
||||
elementEnvironment,
|
||||
commonElements,
|
||||
impacts,
|
||||
nativeBasicData,
|
||||
|
@ -850,25 +855,23 @@ class JavaScriptBackend {
|
|||
/// Creates an [Enqueuer] for code generation specific to this backend.
|
||||
CodegenEnqueuer createCodegenEnqueuer(
|
||||
CompilerTask task, Compiler compiler, ClosedWorld closedWorld) {
|
||||
ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
|
||||
CommonElements commonElements = closedWorld.commonElements;
|
||||
_typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis(
|
||||
compiler.elementEnvironment, this, commonElements, mirrorsData);
|
||||
closedWorld.elementEnvironment, this, commonElements, mirrorsData);
|
||||
_lookupMapAnalysis = new LookupMapAnalysis(
|
||||
reporter,
|
||||
constantSystem,
|
||||
constants,
|
||||
compiler.elementEnvironment,
|
||||
elementEnvironment,
|
||||
commonElements,
|
||||
lookupMapResolutionAnalysis);
|
||||
_mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close();
|
||||
_customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis(
|
||||
constantSystem,
|
||||
commonElements,
|
||||
compiler.elementEnvironment,
|
||||
nativeBasicData);
|
||||
constantSystem, commonElements, elementEnvironment, nativeBasicData);
|
||||
_nativeCodegenEnqueuer = new native.NativeCodegenEnqueuer(
|
||||
compiler.options,
|
||||
compiler.elementEnvironment,
|
||||
elementEnvironment,
|
||||
commonElements,
|
||||
compiler.frontendStrategy.dartTypes,
|
||||
emitter,
|
||||
|
@ -882,7 +885,7 @@ class JavaScriptBackend {
|
|||
nativeBasicData, closedWorld, const TypeMaskStrategy()),
|
||||
compiler.backendStrategy.createCodegenWorkItemBuilder(closedWorld),
|
||||
new CodegenEnqueuerListener(
|
||||
compiler.elementEnvironment,
|
||||
elementEnvironment,
|
||||
commonElements,
|
||||
impacts,
|
||||
closedWorld.backendUsage,
|
||||
|
@ -1063,11 +1066,11 @@ class JavaScriptBackend {
|
|||
_namer = determineNamer(closedWorld, codegenWorldBuilder);
|
||||
tracer = new Tracer(closedWorld, namer, compiler);
|
||||
_rtiEncoder = _namer.rtiEncoder = new RuntimeTypesEncoderImpl(
|
||||
namer, compiler.elementEnvironment, closedWorld.commonElements);
|
||||
namer, closedWorld.elementEnvironment, closedWorld.commonElements);
|
||||
emitter.createEmitter(namer, closedWorld, codegenWorldBuilder);
|
||||
_codegenImpactTransformer = new CodegenImpactTransformer(
|
||||
compiler.options,
|
||||
compiler.elementEnvironment,
|
||||
closedWorld.elementEnvironment,
|
||||
closedWorld.commonElements,
|
||||
impacts,
|
||||
checkedModeHelpers,
|
||||
|
@ -1109,7 +1112,10 @@ class JavaScriptBackend {
|
|||
/// Process backend specific annotations.
|
||||
// TODO(johnniwinther): Merge this with [AnnotationProcessor] and use
|
||||
// [ElementEnvironment.getMemberMetadata] in [AnnotationProcessor].
|
||||
void processAnnotations(CommonElements commonElements, MemberEntity element,
|
||||
void processAnnotations(
|
||||
ElementEnvironment elementEnvironment,
|
||||
CommonElements commonElements,
|
||||
MemberEntity element,
|
||||
ClosedWorldRefiner closedWorldRefiner) {
|
||||
if (element is MemberElement && element.isMalformed) {
|
||||
// Elements that are marked as malformed during parsing or resolution
|
||||
|
@ -1135,7 +1141,7 @@ class JavaScriptBackend {
|
|||
bool hasNoThrows = false;
|
||||
bool hasNoSideEffects = false;
|
||||
for (ConstantValue constantValue
|
||||
in compiler.elementEnvironment.getMemberMetadata(method)) {
|
||||
in elementEnvironment.getMemberMetadata(method)) {
|
||||
if (!constantValue.isConstructedObject) continue;
|
||||
ObjectConstantValue value = constantValue;
|
||||
ClassEntity cls = value.type.element;
|
||||
|
|
|
@ -50,7 +50,7 @@ class ElementBackendStrategy implements BackendStrategy {
|
|||
NativeBasicData nativeBasicData,
|
||||
ClosedWorld closedWorld,
|
||||
SelectorConstraintsStrategy selectorConstraintsStrategy) {
|
||||
return new ElementCodegenWorldBuilderImpl(_compiler.elementEnvironment,
|
||||
return new ElementCodegenWorldBuilderImpl(closedWorld.elementEnvironment,
|
||||
nativeBasicData, closedWorld, selectorConstraintsStrategy);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ class CodeEmitterTask extends CompilerTask {
|
|||
backend.mirrorsData,
|
||||
backend.rtiEncoder);
|
||||
typeTestRegistry = new TypeTestRegistry(
|
||||
codegenWorldBuilder, closedWorld, compiler.elementEnvironment);
|
||||
codegenWorldBuilder, closedWorld, closedWorld.elementEnvironment);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ class CodeEmitterTask extends CompilerTask {
|
|||
ProgramBuilder programBuilder = new ProgramBuilder(
|
||||
compiler.options,
|
||||
compiler.reporter,
|
||||
compiler.elementEnvironment,
|
||||
closedWorld.elementEnvironment,
|
||||
closedWorld.commonElements,
|
||||
compiler.types,
|
||||
compiler.deferredLoadTask,
|
||||
|
|
|
@ -31,7 +31,7 @@ class ClassEmitter extends CodeEmitterHelper {
|
|||
closedWorld.commonElements, namer, codegenWorldBuilder, closedWorld,
|
||||
enableMinification: compiler.options.enableMinification);
|
||||
|
||||
ElementEnvironment get _elementEnvironment => compiler.elementEnvironment;
|
||||
ElementEnvironment get _elementEnvironment => closedWorld.elementEnvironment;
|
||||
|
||||
/**
|
||||
* Documentation wanted -- johnniwinther
|
||||
|
|
|
@ -124,7 +124,7 @@ class Emitter extends js_emitter.EmitterBase {
|
|||
NativeEmitter get nativeEmitter => task.nativeEmitter;
|
||||
TypeTestRegistry get typeTestRegistry => task.typeTestRegistry;
|
||||
CommonElements get commonElements => _closedWorld.commonElements;
|
||||
ElementEnvironment get _elementEnvironment => compiler.elementEnvironment;
|
||||
ElementEnvironment get _elementEnvironment => _closedWorld.elementEnvironment;
|
||||
|
||||
// The full code that is written to each hunk part-file.
|
||||
Map<OutputUnit, CodeOutput> outputBuffers = new Map<OutputUnit, CodeOutput>();
|
||||
|
|
|
@ -44,7 +44,8 @@ class JsToFrontendMap {
|
|||
|
||||
class JsClosedWorld extends ClosedWorldBase {
|
||||
JsClosedWorld(
|
||||
{CommonElements commonElements,
|
||||
{ElementEnvironment elementEnvironment,
|
||||
CommonElements commonElements,
|
||||
ConstantSystem constantSystem,
|
||||
NativeData nativeData,
|
||||
InterceptorData interceptorData,
|
||||
|
@ -58,6 +59,7 @@ class JsClosedWorld extends ClosedWorldBase {
|
|||
Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes,
|
||||
Map<ClassEntity, ClassSet> classSets})
|
||||
: super(
|
||||
elementEnvironment: elementEnvironment,
|
||||
commonElements: commonElements,
|
||||
constantSystem: constantSystem,
|
||||
nativeData: nativeData,
|
||||
|
|
|
@ -89,6 +89,8 @@ class JsBackendStrategy implements BackendStrategy {
|
|||
}, ClassHierarchyNode.ALL);
|
||||
|
||||
return new JsClosedWorld(
|
||||
// TODO(johnniwinther): Create a JsElementEnvironment.
|
||||
elementEnvironment: closedWorld.elementEnvironment,
|
||||
commonElements: commonElements,
|
||||
constantSystem: const JavaScriptConstantSystem(),
|
||||
backendUsage: backendUsage,
|
||||
|
@ -129,7 +131,7 @@ class JsBackendStrategy implements BackendStrategy {
|
|||
NativeBasicData nativeBasicData,
|
||||
ClosedWorld closedWorld,
|
||||
SelectorConstraintsStrategy selectorConstraintsStrategy) {
|
||||
return new KernelCodegenWorldBuilder(_compiler.elementEnvironment,
|
||||
return new KernelCodegenWorldBuilder(closedWorld.elementEnvironment,
|
||||
nativeBasicData, closedWorld, selectorConstraintsStrategy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1530,7 +1530,6 @@ class KernelResolutionWorldBuilder extends KernelResolutionWorldBuilderBase {
|
|||
|
||||
class KernelClosedWorld extends ClosedWorldBase {
|
||||
final KernelToElementMapImpl _elementMap;
|
||||
final ElementEnvironment _elementEnvironment;
|
||||
|
||||
KernelClosedWorld(this._elementMap,
|
||||
{ElementEnvironment elementEnvironment,
|
||||
|
@ -1547,8 +1546,8 @@ class KernelClosedWorld extends ClosedWorldBase {
|
|||
Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses,
|
||||
Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes,
|
||||
Map<ClassEntity, ClassSet> classSets})
|
||||
: this._elementEnvironment = elementEnvironment,
|
||||
super(
|
||||
: super(
|
||||
elementEnvironment: elementEnvironment,
|
||||
commonElements: commonElements,
|
||||
constantSystem: constantSystem,
|
||||
nativeData: nativeData,
|
||||
|
@ -1617,14 +1616,14 @@ class KernelClosedWorld extends ClosedWorldBase {
|
|||
@override
|
||||
bool hasElementIn(ClassEntity cls, Selector selector, Entity element) {
|
||||
while (cls != null) {
|
||||
MemberEntity member = _elementEnvironment
|
||||
MemberEntity member = elementEnvironment
|
||||
.lookupClassMember(cls, selector.name, setter: selector.isSetter);
|
||||
if (member != null &&
|
||||
(!selector.memberName.isPrivate ||
|
||||
member.library == selector.library)) {
|
||||
return member == element;
|
||||
}
|
||||
cls = _elementEnvironment.getSuperClass(cls);
|
||||
cls = elementEnvironment.getSuperClass(cls);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class KernelBackendStrategy implements BackendStrategy {
|
|||
NativeBasicData nativeBasicData,
|
||||
ClosedWorld closedWorld,
|
||||
SelectorConstraintsStrategy selectorConstraintsStrategy) {
|
||||
return new KernelCodegenWorldBuilder(_compiler.elementEnvironment,
|
||||
return new KernelCodegenWorldBuilder(closedWorld.elementEnvironment,
|
||||
nativeBasicData, closedWorld, selectorConstraintsStrategy);
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,8 @@ class NativeDataResolverImpl extends NativeMemberResolverBase
|
|||
|
||||
JavaScriptBackend get _backend => _compiler.backend;
|
||||
DiagnosticReporter get _reporter => _compiler.reporter;
|
||||
ElementEnvironment get elementEnvironment => _compiler.elementEnvironment;
|
||||
ElementEnvironment get elementEnvironment =>
|
||||
_compiler.resolution.elementEnvironment;
|
||||
CommonElements get commonElements => _compiler.resolution.commonElements;
|
||||
NativeBasicData get nativeBasicData => _backend.nativeBasicData;
|
||||
NativeDataBuilder get nativeDataBuilder => _backend.nativeDataBuilder;
|
||||
|
|
|
@ -141,7 +141,8 @@ class KernelAstAdapter extends KernelToElementMapMixin
|
|||
CommonElements get commonElements => _compiler.resolution.commonElements;
|
||||
|
||||
@override
|
||||
ElementEnvironment get elementEnvironment => _compiler.elementEnvironment;
|
||||
ElementEnvironment get elementEnvironment =>
|
||||
_compiler.resolution.elementEnvironment;
|
||||
|
||||
MemberElement get currentMember => _resolvedAst.element;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class ElementResolutionWorldBuilder extends ResolutionWorldBuilderBase {
|
|||
BackendUsageBuilder backendUsageBuilder,
|
||||
SelectorConstraintsStrategy selectorConstraintsStrategy)
|
||||
: super(
|
||||
backend.compiler.elementEnvironment,
|
||||
_resolution.elementEnvironment,
|
||||
_resolution.commonElements,
|
||||
backend.constantSystem,
|
||||
nativeBasicData,
|
||||
|
@ -173,6 +173,7 @@ class ElementResolutionWorldBuilder extends ResolutionWorldBuilderBase {
|
|||
populateHierarchyNodes();
|
||||
_closed = true;
|
||||
return _closedWorldCache = new ClosedWorldImpl(
|
||||
elementEnvironment: _elementEnvironment,
|
||||
commonElements: _commonElements,
|
||||
constantSystem: _constantSystem,
|
||||
nativeData: _nativeDataBuilder.close(),
|
||||
|
|
|
@ -7,7 +7,7 @@ library dart2js.world;
|
|||
import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX;
|
||||
import 'common.dart';
|
||||
import 'constants/constant_system.dart';
|
||||
import 'common_elements.dart' show CommonElements;
|
||||
import 'common_elements.dart' show CommonElements, ElementEnvironment;
|
||||
import 'elements/entities.dart';
|
||||
import 'elements/elements.dart'
|
||||
show
|
||||
|
@ -48,6 +48,8 @@ abstract class ClosedWorld implements World {
|
|||
|
||||
InterceptorData get interceptorData;
|
||||
|
||||
ElementEnvironment get elementEnvironment;
|
||||
|
||||
CommonElements get commonElements;
|
||||
|
||||
CommonMasks get commonMasks;
|
||||
|
@ -429,6 +431,7 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
|
|||
|
||||
CommonMasks _commonMasks;
|
||||
|
||||
final ElementEnvironment elementEnvironment;
|
||||
final CommonElements commonElements;
|
||||
|
||||
// TODO(johnniwinther): Avoid this.
|
||||
|
@ -438,7 +441,8 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
|
|||
final Set<ClassEntity> _implementedClasses;
|
||||
|
||||
ClosedWorldBase(
|
||||
{this.commonElements,
|
||||
{this.elementEnvironment,
|
||||
this.commonElements,
|
||||
this.constantSystem,
|
||||
this.nativeData,
|
||||
this.interceptorData,
|
||||
|
@ -1156,7 +1160,8 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
|
|||
|
||||
class ClosedWorldImpl extends ClosedWorldBase {
|
||||
ClosedWorldImpl(
|
||||
{CommonElements commonElements,
|
||||
{ElementEnvironment elementEnvironment,
|
||||
CommonElements commonElements,
|
||||
ConstantSystem constantSystem,
|
||||
NativeData nativeData,
|
||||
InterceptorData interceptorData,
|
||||
|
@ -1170,6 +1175,7 @@ class ClosedWorldImpl extends ClosedWorldBase {
|
|||
Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes,
|
||||
Map<ClassEntity, ClassSet> classSets})
|
||||
: super(
|
||||
elementEnvironment: elementEnvironment,
|
||||
commonElements: commonElements,
|
||||
constantSystem: constantSystem,
|
||||
nativeData: nativeData,
|
||||
|
|
|
@ -365,7 +365,8 @@ class MyCompiler extends CompilerImpl {
|
|||
resolveLibraryMetadata();
|
||||
}
|
||||
reporter.log('Resolving...');
|
||||
processQueue(resolutionEnqueuer, mainFunction, libraryLoader.libraries);
|
||||
processQueue(frontendStrategy.elementEnvironment, resolutionEnqueuer,
|
||||
mainFunction, libraryLoader.libraries);
|
||||
resolutionEnqueuer.logSummary(reporter.log);
|
||||
|
||||
(reporter as CompilerDiagnosticReporter)
|
||||
|
|
|
@ -78,7 +78,10 @@ Future<String> compile(String code,
|
|||
MethodElement element = mainApp.find(entry);
|
||||
if (element == null) return null;
|
||||
compiler.phase = Compiler.PHASE_RESOLVING;
|
||||
compiler.processQueue(compiler.enqueuer.resolution, element,
|
||||
compiler.processQueue(
|
||||
compiler.frontendStrategy.elementEnvironment,
|
||||
compiler.enqueuer.resolution,
|
||||
element,
|
||||
compiler.libraryLoader.libraries);
|
||||
ResolutionWorkItem resolutionWork =
|
||||
new ResolutionWorkItem(compiler.resolution, element);
|
||||
|
|
|
@ -67,7 +67,8 @@ main() {
|
|||
Expect.equals(0, diagnostics.errors.length);
|
||||
Expect.equals(0, diagnostics.warnings.length);
|
||||
|
||||
ElementEnvironment environment = compiler.elementEnvironment;
|
||||
ElementEnvironment environment =
|
||||
compiler.frontendStrategy.elementEnvironment;
|
||||
LibraryEntity library = environment.lookupLibrary(uri);
|
||||
Expect.isNotNull(library);
|
||||
ClassEntity clss = environment.lookupClass(library, 'ListLiteralTest');
|
||||
|
|
|
@ -46,7 +46,7 @@ checkCode(String annotatedCode, CheckMemberFunction checkMember,
|
|||
expectedMap.forEach((Id id, String expected) {
|
||||
reportHere(
|
||||
compiler.reporter,
|
||||
computeSpannable(compiler.elementEnvironment, mainUri, id),
|
||||
computeSpannable(compiler.resolution.elementEnvironment, mainUri, id),
|
||||
'expected:${expected},actual:null');
|
||||
});
|
||||
Expect.isTrue(expectedMap.isEmpty, "Ids not found: $expectedMap.");
|
||||
|
|
|
@ -124,7 +124,8 @@ Future<ResultKind> mainInternal(List<String> args,
|
|||
await analyzeOnly(entryPoint, memorySourceFiles, printSteps: true);
|
||||
Compiler compiler = compilers.a;
|
||||
compiler.resolutionWorldBuilder.closeWorld();
|
||||
ElementEnvironment environment1 = compiler.elementEnvironment;
|
||||
ElementEnvironment environment1 =
|
||||
compiler.frontendStrategy.elementEnvironment;
|
||||
|
||||
Compiler compiler2 = compilers.b;
|
||||
KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
|
||||
|
@ -134,7 +135,8 @@ Future<ResultKind> mainInternal(List<String> args,
|
|||
KernelEquivalence equivalence = new KernelEquivalence(elementMap);
|
||||
TestStrategy strategy = equivalence.defaultStrategy;
|
||||
|
||||
ElementEnvironment environment2 = compiler2.elementEnvironment;
|
||||
ElementEnvironment environment2 =
|
||||
compiler2.frontendStrategy.elementEnvironment;
|
||||
checkElementEnvironment(environment1, environment2, strategy);
|
||||
|
||||
ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution;
|
||||
|
|
|
@ -112,8 +112,8 @@ main(List<String> args) {
|
|||
const OpenWorldStrategy()),
|
||||
new KernelTestWorkItemBuilder(compiler),
|
||||
'enqueuer from kernel');
|
||||
ClosedWorld closedWorld = computeClosedWorld(
|
||||
compiler.reporter, enqueuer, compiler.elementEnvironment);
|
||||
ClosedWorld closedWorld = computeClosedWorld(compiler.reporter, enqueuer,
|
||||
compiler.frontendStrategy.elementEnvironment);
|
||||
BackendUsage backendUsage = backendUsageBuilder.close();
|
||||
checkResolutionEnqueuers(
|
||||
backendUsage, backendUsage, compiler.enqueuer.resolution, enqueuer,
|
||||
|
@ -138,7 +138,7 @@ List createResolutionEnqueuerListener(Compiler compiler) {
|
|||
InterceptorDataBuilder interceptorDataBuilder =
|
||||
new InterceptorDataBuilderImpl(
|
||||
backend.nativeBasicData,
|
||||
compiler.elementEnvironment,
|
||||
compiler.frontendStrategy.elementEnvironment,
|
||||
compiler.frontendStrategy.commonElements);
|
||||
ResolutionEnqueuerListener listener = new ResolutionEnqueuerListener(
|
||||
compiler.options,
|
||||
|
|
|
@ -268,11 +268,12 @@ main() {
|
|||
}
|
||||
|
||||
checkTest(Compiler compiler, NoSuchMethodTest test, {bool testComplexReturns}) {
|
||||
ElementEnvironment elementEnvironment = compiler.elementEnvironment;
|
||||
ElementEnvironment elementEnvironment =
|
||||
compiler.frontendStrategy.elementEnvironment;
|
||||
NoSuchMethodRegistry registry = compiler.backend.noSuchMethodRegistry;
|
||||
NoSuchMethodResolver resolver = registry.internalResolverForTesting;
|
||||
FunctionEntity ObjectNSM = elementEnvironment.lookupClassMember(
|
||||
compiler.resolution.commonElements.objectClass, 'noSuchMethod');
|
||||
compiler.frontendStrategy.commonElements.objectClass, 'noSuchMethod');
|
||||
ClosedWorld closedWorld =
|
||||
compiler.resolutionWorldBuilder.closedWorldForTesting;
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ Future testSwitch() {
|
|||
MethodElement funElement = fooElement.lookupLocalMember("foo");
|
||||
compiler.enqueuer.resolution.applyImpact(new WorldImpactBuilderImpl()
|
||||
..registerStaticUse(new StaticUse.implicitInvoke(funElement)));
|
||||
compiler.processQueue(
|
||||
compiler.processQueue(compiler.frontendStrategy.elementEnvironment,
|
||||
compiler.enqueuer.resolution, null, compiler.libraryLoader.libraries);
|
||||
DiagnosticCollector collector = compiler.diagnosticCollector;
|
||||
Expect.equals(0, collector.warnings.length);
|
||||
|
|
|
@ -50,7 +50,7 @@ void testTypeRepresentations() {
|
|||
env.compiler.backend.onCodegenStart(
|
||||
closedWorld,
|
||||
new ElementCodegenWorldBuilderImpl(
|
||||
env.compiler.elementEnvironment,
|
||||
closedWorld.elementEnvironment,
|
||||
env.compiler.backend.nativeBasicData,
|
||||
closedWorld,
|
||||
const TypeMaskStrategy()));
|
||||
|
|
Loading…
Reference in a new issue