mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
Rename Universe to WorldBuilder.
R=sigmund@google.com Review URL: https://codereview.chromium.org/2381793003 .
This commit is contained in:
parent
ead7f7030a
commit
c3421b5586
15 changed files with 43 additions and 43 deletions
|
@ -19,7 +19,7 @@ import 'js_backend/js_backend.dart' show JavaScriptBackend;
|
|||
import 'resolution/tree_elements.dart' show TreeElements;
|
||||
import 'tokens/token.dart' show Token;
|
||||
import 'tree/tree.dart';
|
||||
import 'universe/universe.dart' show CodegenUniverse;
|
||||
import 'universe/world_builder.dart' show CodegenWorldBuilder;
|
||||
import 'util/util.dart';
|
||||
|
||||
class ClosureTask extends CompilerTask {
|
||||
|
|
|
@ -73,7 +73,8 @@ import 'typechecker.dart' show TypeCheckerTask;
|
|||
import 'types/types.dart' show GlobalTypeInferenceTask;
|
||||
import 'types/masks.dart' show CommonMasks;
|
||||
import 'universe/selector.dart' show Selector;
|
||||
import 'universe/universe.dart' show ResolutionUniverse, CodegenUniverse;
|
||||
import 'universe/world_builder.dart'
|
||||
show ResolutionWorldBuilder, CodegenWorldBuilder;
|
||||
import 'universe/use.dart' show StaticUse;
|
||||
import 'universe/world_impact.dart' show ImpactStrategy, WorldImpact;
|
||||
import 'util/util.dart' show Link, Setlet;
|
||||
|
@ -333,8 +334,8 @@ abstract class Compiler implements LibraryLoaderListener {
|
|||
|
||||
// TODO(johnniwinther): Rename these appropriately when unification of worlds/
|
||||
// universes is complete.
|
||||
ResolutionUniverse get resolverWorld => enqueuer.resolution.universe;
|
||||
CodegenUniverse get codegenWorld => enqueuer.codegen.universe;
|
||||
ResolutionWorldBuilder get resolverWorld => enqueuer.resolution.universe;
|
||||
CodegenWorldBuilder get codegenWorld => enqueuer.codegen.universe;
|
||||
|
||||
bool get analyzeAll => options.analyzeAll || compileAll;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import 'js/js.dart' as jsAst;
|
|||
import 'js_backend/js_backend.dart' show JavaScriptBackend;
|
||||
import 'js_emitter/full_emitter/emitter.dart' as full show Emitter;
|
||||
import 'types/types.dart' show TypeMask;
|
||||
import 'universe/universe.dart' show ReceiverConstraint;
|
||||
import 'universe/world_builder.dart' show ReceiverConstraint;
|
||||
import 'universe/world_impact.dart'
|
||||
show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import 'elements/elements.dart'
|
|||
import 'native/native.dart' as native;
|
||||
import 'types/types.dart' show TypeMaskStrategy;
|
||||
import 'universe/selector.dart' show Selector;
|
||||
import 'universe/universe.dart';
|
||||
import 'universe/world_builder.dart';
|
||||
import 'universe/use.dart'
|
||||
show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
|
||||
import 'universe/world_impact.dart'
|
||||
|
@ -71,7 +71,7 @@ class EnqueueTask extends CompilerTask {
|
|||
|
||||
abstract class Enqueuer {
|
||||
EnqueueTask task;
|
||||
Universe get universe;
|
||||
WorldBuilder get universe;
|
||||
native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask
|
||||
void forgetElement(Element element);
|
||||
void processInstantiatedClassMembers(ClassElement cls);
|
||||
|
@ -135,8 +135,8 @@ class ResolutionEnqueuer extends Enqueuer {
|
|||
new Map<String, Set<Element>>();
|
||||
final Set<ClassElement> _processedClasses = new Set<ClassElement>();
|
||||
Set<ClassElement> recentClasses = new Setlet<ClassElement>();
|
||||
final ResolutionUniverseImpl _universe =
|
||||
new ResolutionUniverseImpl(const TypeMaskStrategy());
|
||||
final ResolutionWorldBuilderImpl _universe =
|
||||
new ResolutionWorldBuilderImpl(const TypeMaskStrategy());
|
||||
|
||||
static final TRACE_MIRROR_ENQUEUING =
|
||||
const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING");
|
||||
|
@ -160,7 +160,7 @@ class ResolutionEnqueuer extends Enqueuer {
|
|||
// TODO(johnniwinther): Move this to [ResolutionEnqueuer].
|
||||
Resolution get resolution => compiler.resolution;
|
||||
|
||||
ResolutionUniverse get universe => _universe;
|
||||
ResolutionWorldBuilder get universe => _universe;
|
||||
|
||||
bool get queueIsEmpty => queue.isEmpty;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ import '../types/types.dart';
|
|||
import '../universe/call_structure.dart' show CallStructure;
|
||||
import '../universe/feature.dart';
|
||||
import '../universe/selector.dart' show Selector;
|
||||
import '../universe/universe.dart';
|
||||
import '../universe/world_builder.dart';
|
||||
import '../universe/use.dart'
|
||||
show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
|
||||
import '../universe/world_impact.dart'
|
||||
|
|
|
@ -34,7 +34,7 @@ import '../native/native.dart' as native;
|
|||
import '../options.dart';
|
||||
import '../types/types.dart' show TypeMaskStrategy;
|
||||
import '../universe/selector.dart' show Selector;
|
||||
import '../universe/universe.dart';
|
||||
import '../universe/world_builder.dart';
|
||||
import '../universe/use.dart'
|
||||
show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
|
||||
import '../universe/world_impact.dart'
|
||||
|
@ -54,8 +54,8 @@ class CodegenEnqueuer implements Enqueuer {
|
|||
new Map<String, Set<Element>>();
|
||||
final Set<ClassElement> _processedClasses = new Set<ClassElement>();
|
||||
Set<ClassElement> recentClasses = new Setlet<ClassElement>();
|
||||
final CodegenUniverseImpl _universe =
|
||||
new CodegenUniverseImpl(const TypeMaskStrategy());
|
||||
final CodegenWorldBuilderImpl _universe =
|
||||
new CodegenWorldBuilderImpl(const TypeMaskStrategy());
|
||||
|
||||
static final TRACE_MIRROR_ENQUEUING =
|
||||
const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING");
|
||||
|
@ -78,7 +78,7 @@ class CodegenEnqueuer implements Enqueuer {
|
|||
impactVisitor = new _EnqueuerImpactVisitor(this);
|
||||
}
|
||||
|
||||
CodegenUniverse get universe => _universe;
|
||||
CodegenWorldBuilder get universe => _universe;
|
||||
|
||||
Backend get backend => _compiler.backend;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import '../elements/elements.dart'
|
|||
import '../js/js.dart' as jsAst;
|
||||
import '../js/js.dart' show js;
|
||||
import '../universe/selector.dart' show Selector;
|
||||
import '../universe/universe.dart' show SelectorConstraints;
|
||||
import '../universe/world_builder.dart' show SelectorConstraints;
|
||||
import 'backend_helpers.dart' show BackendHelpers;
|
||||
import 'js_backend.dart' show JavaScriptBackend;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ abstract class RuntimeTypes {
|
|||
///
|
||||
/// This function must be called after all is-checks have been registered.
|
||||
void addImplicitChecks(
|
||||
Universe universe, Iterable<ClassElement> classesUsingChecks);
|
||||
WorldBuilder universe, Iterable<ClassElement> classesUsingChecks);
|
||||
|
||||
/// Return all classes that are referenced in the type of the function, i.e.,
|
||||
/// in the return type or the argument types.
|
||||
|
@ -170,7 +170,7 @@ class _RuntimeTypes implements RuntimeTypes {
|
|||
*/
|
||||
@override
|
||||
void addImplicitChecks(
|
||||
Universe universe, Iterable<ClassElement> classesUsingChecks) {
|
||||
WorldBuilder universe, Iterable<ClassElement> classesUsingChecks) {
|
||||
// If there are no classes that use their variables in checks, there is
|
||||
// nothing to do.
|
||||
if (classesUsingChecks.isEmpty) return;
|
||||
|
@ -364,7 +364,8 @@ class _RuntimeTypes implements RuntimeTypes {
|
|||
computeChecks(allInstantiatedArguments, checkedArguments);
|
||||
}
|
||||
|
||||
Set<DartType> computeInstantiatedTypesAndClosures(CodegenUniverse universe) {
|
||||
Set<DartType> computeInstantiatedTypesAndClosures(
|
||||
CodegenWorldBuilder universe) {
|
||||
Set<DartType> instantiatedTypes =
|
||||
new Set<DartType>.from(universe.instantiatedTypes);
|
||||
for (DartType instantiatedType in universe.instantiatedTypes) {
|
||||
|
|
|
@ -56,7 +56,7 @@ import '../js_backend/js_backend.dart'
|
|||
TypeVariableHandler;
|
||||
import '../universe/call_structure.dart' show CallStructure;
|
||||
import '../universe/selector.dart' show Selector;
|
||||
import '../universe/universe.dart' show SelectorConstraints;
|
||||
import '../universe/world_builder.dart' show SelectorConstraints;
|
||||
import '../util/util.dart' show Setlet;
|
||||
import 'full_emitter/emitter.dart' as full_js_emitter;
|
||||
import 'lazy_emitter/emitter.dart' as lazy_js_emitter;
|
||||
|
|
|
@ -32,7 +32,8 @@ import '../../js_backend/backend_helpers.dart' show BackendHelpers;
|
|||
import '../../js_backend/js_backend.dart'
|
||||
show Namer, JavaScriptBackend, JavaScriptConstantCompiler, StringBackedName;
|
||||
import '../../universe/selector.dart' show Selector;
|
||||
import '../../universe/universe.dart' show CodegenUniverse, SelectorConstraints;
|
||||
import '../../universe/world_builder.dart'
|
||||
show CodegenWorldBuilder, SelectorConstraints;
|
||||
import '../js_emitter.dart'
|
||||
show
|
||||
ClassStubGenerator,
|
||||
|
@ -79,7 +80,7 @@ class ProgramBuilder {
|
|||
|
||||
JavaScriptBackend get backend => _compiler.backend;
|
||||
BackendHelpers get helpers => backend.helpers;
|
||||
CodegenUniverse get universe => _compiler.codegenWorld;
|
||||
CodegenWorldBuilder get universe => _compiler.codegenWorld;
|
||||
|
||||
/// Mapping from [ClassElement] to constructed [Class]. We need this to
|
||||
/// update the superclass in the [Class].
|
||||
|
@ -168,8 +169,8 @@ class ProgramBuilder {
|
|||
|
||||
List<Holder> holders = _registry.holders.toList(growable: false);
|
||||
|
||||
bool needsNativeSupport = _compiler.enqueuer.codegen.nativeEnqueuer
|
||||
.hasInstantiatedNativeClasses;
|
||||
bool needsNativeSupport =
|
||||
_compiler.enqueuer.codegen.nativeEnqueuer.hasInstantiatedNativeClasses;
|
||||
|
||||
assert(!needsNativeSupport || nativeClasses.isNotEmpty);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import '../elements/elements.dart';
|
|||
import '../inferrer/type_graph_inferrer.dart' show TypeGraphInferrer;
|
||||
import '../tree/tree.dart';
|
||||
import '../universe/selector.dart' show Selector;
|
||||
import '../universe/universe.dart'
|
||||
import '../universe/world_builder.dart'
|
||||
show
|
||||
ReceiverConstraint,
|
||||
UniverseSelectorConstraints,
|
||||
|
|
|
@ -11,7 +11,7 @@ import '../types/types.dart';
|
|||
import '../util/util.dart' show Hashing, Setlet;
|
||||
import '../world.dart' show ClosedWorld;
|
||||
import 'selector.dart' show Selector;
|
||||
import 'universe.dart' show ReceiverConstraint;
|
||||
import 'world_builder.dart' show ReceiverConstraint;
|
||||
|
||||
// TODO(kasperl): This actually holds getters and setters just fine
|
||||
// too and stricly they aren't functions. Maybe this needs a better
|
||||
|
|
|
@ -24,7 +24,7 @@ import '../util/util.dart' show Hashing;
|
|||
import '../world.dart' show World;
|
||||
import 'call_structure.dart' show CallStructure;
|
||||
import 'selector.dart' show Selector;
|
||||
import 'universe.dart' show ReceiverConstraint;
|
||||
import 'world_builder.dart' show ReceiverConstraint;
|
||||
|
||||
enum DynamicUseKind { INVOKE, GET, SET, }
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ abstract class SelectorConstraints {
|
|||
bool needsNoSuchMethodHandling(Selector selector, World world);
|
||||
}
|
||||
|
||||
/// A mutable [SelectorConstraints] used in [Universe].
|
||||
/// A mutable [SelectorConstraints] used in [WorldBuilder].
|
||||
abstract class UniverseSelectorConstraints extends SelectorConstraints {
|
||||
/// Adds [constraint] to these selector constraints. Return `true` if the set
|
||||
/// of potential receivers expanded due to the new constraint.
|
||||
|
@ -102,14 +102,11 @@ abstract class SelectorConstraintsStrategy {
|
|||
UniverseSelectorConstraints createSelectorConstraints(Selector selector);
|
||||
}
|
||||
|
||||
/// The [Universe] is an auxiliary class used in the process of computing the
|
||||
/// [ClosedWorld]. The concepts here and in [ClosedWorld] are very similar -- in
|
||||
/// the same way that the "universe expands" you can think of this as a mutable
|
||||
/// world that is expanding as we visit and discover parts of the program.
|
||||
// TODO(sigmund): rename to "growing/expanding/mutable world"?
|
||||
// TODO(johnniwinther): Move common implementation to a [UniverseBase] when
|
||||
/// The [WorldBuilder] is an auxiliary class used in the process of computing
|
||||
/// the [ClosedWorld].
|
||||
// TODO(johnniwinther): Move common implementation to a [WorldBuilderBase] when
|
||||
// universes and worlds have been unified.
|
||||
abstract class Universe {
|
||||
abstract class WorldBuilder {
|
||||
/// All directly instantiated classes, that is, classes with a generative
|
||||
/// constructor that has been called directly and not only through a
|
||||
/// super-call.
|
||||
|
@ -132,7 +129,7 @@ abstract class Universe {
|
|||
bool hasInvokedSetter(Element member, World world);
|
||||
}
|
||||
|
||||
abstract class ResolutionUniverse implements Universe {
|
||||
abstract class ResolutionWorldBuilder implements WorldBuilder {
|
||||
/// Set of (live) local functions (closures) whose signatures reference type
|
||||
/// variables.
|
||||
///
|
||||
|
@ -161,7 +158,7 @@ abstract class ResolutionUniverse implements Universe {
|
|||
Iterable<Element> get fieldSetters;
|
||||
}
|
||||
|
||||
class ResolutionUniverseImpl implements ResolutionUniverse {
|
||||
class ResolutionWorldBuilderImpl implements ResolutionWorldBuilder {
|
||||
/// The set of all directly instantiated classes, that is, classes with a
|
||||
/// generative constructor that has been called directly and not only through
|
||||
/// a super-call.
|
||||
|
@ -233,7 +230,7 @@ class ResolutionUniverseImpl implements ResolutionUniverse {
|
|||
|
||||
final SelectorConstraintsStrategy selectorConstraintsStrategy;
|
||||
|
||||
ResolutionUniverseImpl(this.selectorConstraintsStrategy);
|
||||
ResolutionWorldBuilderImpl(this.selectorConstraintsStrategy);
|
||||
|
||||
/// All directly instantiated classes, that is, classes with a generative
|
||||
/// constructor that has been called directly and not only through a
|
||||
|
@ -407,10 +404,10 @@ class ResolutionUniverseImpl implements ResolutionUniverse {
|
|||
}
|
||||
}
|
||||
|
||||
/// Universe specific to codegen.
|
||||
/// World builder specific to codegen.
|
||||
///
|
||||
/// This adds additional access to liveness of selectors and elements.
|
||||
abstract class CodegenUniverse implements Universe {
|
||||
abstract class CodegenWorldBuilder implements WorldBuilder {
|
||||
void forEachInvokedName(
|
||||
f(String name, Map<Selector, SelectorConstraints> selectors));
|
||||
|
||||
|
@ -437,7 +434,7 @@ abstract class CodegenUniverse implements Universe {
|
|||
Iterable<FieldElement> get allReferencedStaticFields;
|
||||
}
|
||||
|
||||
class CodegenUniverseImpl implements CodegenUniverse {
|
||||
class CodegenWorldBuilderImpl implements CodegenWorldBuilder {
|
||||
/// The set of all directly instantiated classes, that is, classes with a
|
||||
/// generative constructor that has been called directly and not only through
|
||||
/// a super-call.
|
||||
|
@ -482,7 +479,7 @@ class CodegenUniverseImpl implements CodegenUniverse {
|
|||
|
||||
final SelectorConstraintsStrategy selectorConstraintsStrategy;
|
||||
|
||||
CodegenUniverseImpl(this.selectorConstraintsStrategy);
|
||||
CodegenWorldBuilderImpl(this.selectorConstraintsStrategy);
|
||||
|
||||
/// All directly instantiated classes, that is, classes with a generative
|
||||
/// constructor that has been called directly and not only through a
|
|
@ -39,7 +39,7 @@ const Map<String, List<String>> WHITE_LIST = const {
|
|||
// Serialization code is only used in test.
|
||||
"lib/src/serialization/": const ["is never"],
|
||||
|
||||
"lib/src/universe/universe.dart": const [
|
||||
"lib/src/universe/world_builder.dart": const [
|
||||
"The method 'getterInvocationsByName' is never called.",
|
||||
"The method 'setterInvocationsByName' is never called."
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue