| Index: pkg/dartino_compiler/lib/src/dartino_backend.dart
|
| diff --git a/pkg/fletchc/lib/src/fletch_backend.dart b/pkg/dartino_compiler/lib/src/dartino_backend.dart
|
| similarity index 81%
|
| rename from pkg/fletchc/lib/src/fletch_backend.dart
|
| rename to pkg/dartino_compiler/lib/src/dartino_backend.dart
|
| index 03aec80ade2327fb4c2cddfe7f5d1e0969e61ac9..50e901fca075df3711b5292fcb4c102d7c93f0ad 100644
|
| --- a/pkg/fletchc/lib/src/fletch_backend.dart
|
| +++ b/pkg/dartino_compiler/lib/src/dartino_backend.dart
|
| @@ -2,7 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE.md file.
|
|
|
| -library fletchc.fletch_backend;
|
| +library dartino_compiler.dartino_backend;
|
|
|
| import 'dart:async' show
|
| Future;
|
| @@ -104,25 +104,25 @@ import 'package:compiler/src/library_loader.dart' show
|
| import 'package:persistent/persistent.dart' show
|
| PersistentMap;
|
|
|
| -import 'fletch_function_builder.dart' show
|
| - FletchFunctionBuilder;
|
| +import 'dartino_function_builder.dart' show
|
| + DartinoFunctionBuilder;
|
|
|
| -import 'fletch_class_builder.dart' show
|
| - FletchClassBuilder;
|
| +import 'dartino_class_builder.dart' show
|
| + DartinoClassBuilder;
|
|
|
| -import 'fletch_system_builder.dart' show
|
| - FletchSystemBuilder;
|
| +import 'dartino_system_builder.dart' show
|
| + DartinoSystemBuilder;
|
|
|
| import '../incremental_backend.dart' show
|
| - IncrementalFletchBackend;
|
| + IncrementalDartinoBackend;
|
|
|
| -import 'fletch_enqueuer.dart' show
|
| - FletchEnqueueTask,
|
| +import 'dartino_enqueuer.dart' show
|
| + DartinoEnqueueTask,
|
| shouldReportEnqueuingOfElement;
|
|
|
| -import 'fletch_registry.dart' show
|
| +import 'dartino_registry.dart' show
|
| ClosureKind,
|
| - FletchRegistry;
|
| + DartinoRegistry;
|
|
|
| import 'diagnostic.dart' show
|
| throwInternalError;
|
| @@ -142,8 +142,8 @@ import 'debug_info.dart';
|
| import 'debug_info_constructor_codegen.dart';
|
| import 'debug_info_function_codegen.dart';
|
| import 'debug_info_lazy_field_initializer_codegen.dart';
|
| -import 'fletch_context.dart';
|
| -import 'fletch_selector.dart';
|
| +import 'dartino_context.dart';
|
| +import 'dartino_selector.dart';
|
| import 'function_codegen.dart';
|
| import 'lazy_field_initializer_codegen.dart';
|
| import 'constructor_codegen.dart';
|
| @@ -151,41 +151,41 @@ import 'closure_environment.dart';
|
|
|
| import '../bytecodes.dart';
|
| import '../vm_commands.dart';
|
| -import '../fletch_system.dart';
|
| +import '../dartino_system.dart';
|
| import 'package:compiler/src/common/resolution.dart';
|
|
|
| -const FletchSystem BASE_FLETCH_SYSTEM = const FletchSystem(
|
| - const PersistentMap<int, FletchFunction>(),
|
| - const PersistentMap<Element, FletchFunction>(),
|
| - const PersistentMap<ConstructorElement, FletchFunction>(),
|
| +const DartinoSystem BASE_DARTINO_SYSTEM = const DartinoSystem(
|
| + const PersistentMap<int, DartinoFunction>(),
|
| + const PersistentMap<Element, DartinoFunction>(),
|
| + const PersistentMap<ConstructorElement, DartinoFunction>(),
|
| const PersistentMap<int, int>(),
|
| - const PersistentMap<int, FletchClass>(),
|
| - const PersistentMap<ClassElement, FletchClass>(),
|
| - const PersistentMap<int, FletchConstant>(),
|
| - const PersistentMap<ConstantValue, FletchConstant>(),
|
| + const PersistentMap<int, DartinoClass>(),
|
| + const PersistentMap<ClassElement, DartinoClass>(),
|
| + const PersistentMap<int, DartinoConstant>(),
|
| + const PersistentMap<ConstantValue, DartinoConstant>(),
|
| const PersistentMap<int, String>(),
|
| const PersistentMap<int, int>(),
|
| const PersistentMap<int, int>(),
|
| - const PersistentMap<ParameterStubSignature, FletchFunction>());
|
| + const PersistentMap<ParameterStubSignature, DartinoFunction>());
|
|
|
| -class FletchBackend extends Backend
|
| - implements IncrementalFletchBackend {
|
| +class DartinoBackend extends Backend
|
| + implements IncrementalDartinoBackend {
|
| static const String growableListName = '_GrowableList';
|
| static const String constantListName = '_ConstantList';
|
| static const String constantByteListName = '_ConstantByteList';
|
| static const String constantMapName = '_ConstantMap';
|
| - static const String fletchNoSuchMethodErrorName = 'FletchNoSuchMethodError';
|
| + static const String dartinoNoSuchMethodErrorName = 'DartinoNoSuchMethodError';
|
| static const String noSuchMethodName = '_noSuchMethod';
|
| static const String noSuchMethodTrampolineName = '_noSuchMethodTrampoline';
|
|
|
| - final FletchContext context;
|
| + final DartinoContext context;
|
|
|
| final DartConstantTask constantCompilerTask;
|
|
|
| /// Constructors that need to have an initilizer compiled. See
|
| /// [compilePendingConstructorInitializers].
|
| - final Queue<FletchFunctionBuilder> pendingConstructorInitializers =
|
| - new Queue<FletchFunctionBuilder>();
|
| + final Queue<DartinoFunctionBuilder> pendingConstructorInitializers =
|
| + new Queue<DartinoFunctionBuilder>();
|
|
|
| final Set<FunctionElement> externals = new Set<FunctionElement>();
|
|
|
| @@ -193,100 +193,100 @@ class FletchBackend extends Backend
|
| final Map<ClassElement, Set<ClassElement>> directSubclasses =
|
| <ClassElement, Set<ClassElement>>{};
|
|
|
| - /// Set of classes that have special meaning to the Fletch VM. They're
|
| + /// Set of classes that have special meaning to the Dartino VM. They're
|
| /// created using [PushBuiltinClass] instead of [PushNewClass].
|
| - // TODO(ahe): Move this to FletchSystem?
|
| + // TODO(ahe): Move this to DartinoSystem?
|
| final Set<ClassElement> builtinClasses = new Set<ClassElement>();
|
|
|
| - // TODO(ahe): This should be invalidated by a new [FletchSystem].
|
| + // TODO(ahe): This should be invalidated by a new [DartinoSystem].
|
| final Map<MemberElement, ClosureEnvironment> closureEnvironments =
|
| <MemberElement, ClosureEnvironment>{};
|
|
|
| - // TODO(ahe): This should be moved to [FletchSystem].
|
| - final Map<FunctionElement, FletchClassBuilder> closureClasses =
|
| - <FunctionElement, FletchClassBuilder>{};
|
| + // TODO(ahe): This should be moved to [DartinoSystem].
|
| + final Map<FunctionElement, DartinoClassBuilder> closureClasses =
|
| + <FunctionElement, DartinoClassBuilder>{};
|
|
|
| - // TODO(ahe): This should be moved to [FletchSystem].
|
| - final Map<FieldElement, FletchFunctionBuilder> lazyFieldInitializers =
|
| - <FieldElement, FletchFunctionBuilder>{};
|
| + // TODO(ahe): This should be moved to [DartinoSystem].
|
| + final Map<FieldElement, DartinoFunctionBuilder> lazyFieldInitializers =
|
| + <FieldElement, DartinoFunctionBuilder>{};
|
|
|
| - // TODO(ahe): This should be moved to [FletchSystem].
|
| - Map<FletchClassBuilder, FletchFunctionBuilder> tearoffFunctions;
|
| + // TODO(ahe): This should be moved to [DartinoSystem].
|
| + Map<DartinoClassBuilder, DartinoFunctionBuilder> tearoffFunctions;
|
|
|
| - FletchCompilerImplementation get compiler => super.compiler;
|
| + DartinoCompilerImplementation get compiler => super.compiler;
|
|
|
| - LibraryElement fletchSystemLibrary;
|
| - LibraryElement fletchFFILibrary;
|
| + LibraryElement dartinoSystemLibrary;
|
| + LibraryElement dartinoFFILibrary;
|
| LibraryElement collectionLibrary;
|
| LibraryElement mathLibrary;
|
| LibraryElement get asyncLibrary => compiler.asyncLibrary;
|
| - LibraryElement fletchLibrary;
|
| + LibraryElement dartinoLibrary;
|
|
|
| - FunctionElement fletchSystemEntry;
|
| + FunctionElement dartinoSystemEntry;
|
|
|
| - FunctionElement fletchExternalInvokeMain;
|
| + FunctionElement dartinoExternalInvokeMain;
|
|
|
| - FunctionElement fletchExternalYield;
|
| + FunctionElement dartinoExternalYield;
|
|
|
| - FunctionElement fletchExternalNativeError;
|
| + FunctionElement dartinoExternalNativeError;
|
|
|
| - FunctionElement fletchExternalCoroutineChange;
|
| + FunctionElement dartinoExternalCoroutineChange;
|
|
|
| - FunctionElement fletchUnresolved;
|
| - FunctionElement fletchCompileError;
|
| + FunctionElement dartinoUnresolved;
|
| + FunctionElement dartinoCompileError;
|
|
|
| - FletchClassBuilder compiledObjectClass;
|
| + DartinoClassBuilder compiledObjectClass;
|
|
|
| ClassElement smiClass;
|
| ClassElement mintClass;
|
| ClassElement growableListClass;
|
| - ClassElement fletchNoSuchMethodErrorClass;
|
| + ClassElement dartinoNoSuchMethodErrorClass;
|
| ClassElement bigintClass;
|
| ClassElement uint32DigitsClass;
|
|
|
| - FletchClassBuilder compiledClosureClass;
|
| + DartinoClassBuilder compiledClosureClass;
|
|
|
| /// Holds a reference to the class Coroutine if it exists.
|
| ClassElement coroutineClass;
|
|
|
| - FletchSystemBuilder systemBuilder;
|
| + DartinoSystemBuilder systemBuilder;
|
|
|
| final Set<FunctionElement> alwaysEnqueue = new Set<FunctionElement>();
|
|
|
| - FletchImpactTransformer impactTransformer;
|
| + DartinoImpactTransformer impactTransformer;
|
|
|
| - FletchBackend(FletchCompilerImplementation compiler)
|
| + DartinoBackend(DartinoCompilerImplementation compiler)
|
| : this.context = compiler.context,
|
| this.constantCompilerTask = new DartConstantTask(compiler),
|
| - this.systemBuilder = new FletchSystemBuilder(BASE_FLETCH_SYSTEM),
|
| + this.systemBuilder = new DartinoSystemBuilder(BASE_DARTINO_SYSTEM),
|
| super(compiler) {
|
| - this.impactTransformer = new FletchImpactTransformer(this);
|
| + this.impactTransformer = new DartinoImpactTransformer(this);
|
| }
|
|
|
| - void newSystemBuilder(FletchSystem predecessorSystem) {
|
| - systemBuilder = new FletchSystemBuilder(predecessorSystem);
|
| + void newSystemBuilder(DartinoSystem predecessorSystem) {
|
| + systemBuilder = new DartinoSystemBuilder(predecessorSystem);
|
| }
|
|
|
| - // TODO(zarah): Move to FletchSystemBuilder.
|
| - FletchClassBuilder getClassBuilderOfExistingClass(int id) {
|
| - FletchClassBuilder classBuilder = systemBuilder.lookupClassBuilder(id);
|
| + // TODO(zarah): Move to DartinoSystemBuilder.
|
| + DartinoClassBuilder getClassBuilderOfExistingClass(int id) {
|
| + DartinoClassBuilder classBuilder = systemBuilder.lookupClassBuilder(id);
|
| if (classBuilder != null) return classBuilder;
|
| - FletchClass klass = systemBuilder.lookupClass(id);
|
| + DartinoClass klass = systemBuilder.lookupClass(id);
|
| if (klass.element != null) return registerClassElement(klass.element);
|
| // [klass] is a tearoff class
|
| return systemBuilder.newPatchClassBuilder(id, compiledClosureClass);
|
| }
|
|
|
| - FletchClassBuilder registerClassElement(ClassElement element) {
|
| + DartinoClassBuilder registerClassElement(ClassElement element) {
|
| if (element == null) return null;
|
| assert(element.isDeclaration);
|
|
|
| - FletchClassBuilder classBuilder =
|
| + DartinoClassBuilder classBuilder =
|
| systemBuilder.lookupClassBuilderByElement(element);
|
| if (classBuilder != null) return classBuilder;
|
|
|
| directSubclasses[element] = new Set<ClassElement>();
|
| - FletchClassBuilder superclass = registerClassElement(element.superclass);
|
| + DartinoClassBuilder superclass = registerClassElement(element.superclass);
|
| if (superclass != null) {
|
| Set<ClassElement> subclasses = directSubclasses[element.superclass];
|
| subclasses.add(element);
|
| @@ -294,7 +294,7 @@ class FletchBackend extends Backend
|
| classBuilder = systemBuilder.newClassBuilder(
|
| element, superclass, builtinClasses.contains(element));
|
|
|
| - // TODO(ajohnsen): Currently, the FletchRegistry does not enqueue fields.
|
| + // TODO(ajohnsen): Currently, the DartinoRegistry does not enqueue fields.
|
| // This is a workaround, where we basically add getters for all fields.
|
| classBuilder.updateImplicitAccessors(this);
|
|
|
| @@ -307,9 +307,9 @@ class FletchBackend extends Backend
|
| return classBuilder;
|
| }
|
|
|
| - FletchClassBuilder createCallableStubClass(
|
| - int fields, int arity, FletchClassBuilder superclass) {
|
| - FletchClassBuilder classBuilder = systemBuilder.newClassBuilder(
|
| + DartinoClassBuilder createCallableStubClass(
|
| + int fields, int arity, DartinoClassBuilder superclass) {
|
| + DartinoClassBuilder classBuilder = systemBuilder.newClassBuilder(
|
| null, superclass, false, extraFields: fields);
|
| classBuilder.createIsFunctionEntry(this, arity);
|
| return classBuilder;
|
| @@ -328,12 +328,12 @@ class FletchBackend extends Backend
|
| bool methodNeedsRti(FunctionElement function) => false;
|
|
|
| void enqueueHelpers(ResolutionEnqueuer world, Registry incomingRegistry) {
|
| - FletchRegistry registry = new FletchRegistry(compiler);
|
| + DartinoRegistry registry = new DartinoRegistry(compiler);
|
| compiler.patchAnnotationClass = patchAnnotationClass;
|
|
|
| bool hasMissingHelpers = false;
|
| loadHelperMethods((String name) {
|
| - LibraryElement library = fletchSystemLibrary;
|
| + LibraryElement library = dartinoSystemLibrary;
|
| Element helper = library.findLocal(name);
|
| // TODO(ahe): Make it cleaner.
|
| if (helper != null && helper.isAbstractField) {
|
| @@ -353,11 +353,11 @@ class FletchBackend extends Backend
|
| "Some implementation methods are missing, see details above");
|
| }
|
| world.registerStaticUse(
|
| - new StaticUse.staticInvoke(fletchCompileError, CallStructure.ONE_ARG));
|
| + new StaticUse.staticInvoke(dartinoCompileError, CallStructure.ONE_ARG));
|
| world.registerStaticUse(
|
| - new StaticUse.staticInvoke(fletchSystemEntry, CallStructure.ONE_ARG));
|
| + new StaticUse.staticInvoke(dartinoSystemEntry, CallStructure.ONE_ARG));
|
| world.registerStaticUse(
|
| - new StaticUse.staticInvoke(fletchUnresolved, CallStructure.ONE_ARG));
|
| + new StaticUse.staticInvoke(dartinoUnresolved, CallStructure.ONE_ARG));
|
|
|
| loadHelperClasses((
|
| String name,
|
| @@ -431,17 +431,17 @@ class FletchBackend extends Backend
|
| return helper;
|
| }
|
|
|
| - fletchSystemEntry = findHelper('entry');
|
| - fletchExternalInvokeMain = findExternal('invokeMain');
|
| - fletchExternalYield = findExternal('yield');
|
| - fletchExternalCoroutineChange = findExternal('coroutineChange');
|
| - fletchExternalNativeError = findExternal('nativeError');
|
| - fletchUnresolved = findExternal('unresolved');
|
| - fletchCompileError = findExternal('compileError');
|
| + dartinoSystemEntry = findHelper('entry');
|
| + dartinoExternalInvokeMain = findExternal('invokeMain');
|
| + dartinoExternalYield = findExternal('yield');
|
| + dartinoExternalCoroutineChange = findExternal('coroutineChange');
|
| + dartinoExternalNativeError = findExternal('nativeError');
|
| + dartinoUnresolved = findExternal('unresolved');
|
| + dartinoCompileError = findExternal('compileError');
|
| }
|
|
|
| void loadHelperClasses(
|
| - FletchClassBuilder loadClass(
|
| + DartinoClassBuilder loadClass(
|
| String name,
|
| LibraryElement library,
|
| {bool builtin})) {
|
| @@ -455,31 +455,31 @@ class FletchBackend extends Backend
|
| loadClass("_OneByteString", compiler.coreLibrary, builtin: true);
|
| loadClass("_TwoByteString", compiler.coreLibrary, builtin: true);
|
| // TODO(ahe): Register _ConstantList through ResolutionCallbacks.
|
| - loadClass(constantListName, fletchSystemLibrary, builtin: true);
|
| - loadClass(constantByteListName, fletchSystemLibrary, builtin: true);
|
| - loadClass(constantMapName, fletchSystemLibrary, builtin: true);
|
| + loadClass(constantListName, dartinoSystemLibrary, builtin: true);
|
| + loadClass(constantByteListName, dartinoSystemLibrary, builtin: true);
|
| + loadClass(constantMapName, dartinoSystemLibrary, builtin: true);
|
| loadClass("_DoubleImpl", compiler.coreLibrary, builtin: true);
|
| loadClass("Null", compiler.coreLibrary, builtin: true);
|
| loadClass("bool", compiler.coreLibrary, builtin: true);
|
| loadClass("StackOverflowError", compiler.coreLibrary, builtin: true);
|
| - loadClass("Port", fletchLibrary, builtin: true);
|
| - loadClass("Process", fletchLibrary, builtin: true);
|
| - loadClass("ProcessDeath", fletchLibrary, builtin: true);
|
| - loadClass("ForeignMemory", fletchFFILibrary, builtin: true);
|
| + loadClass("Port", dartinoLibrary, builtin: true);
|
| + loadClass("Process", dartinoLibrary, builtin: true);
|
| + loadClass("ProcessDeath", dartinoLibrary, builtin: true);
|
| + loadClass("ForeignMemory", dartinoFFILibrary, builtin: true);
|
| if (context.enableBigint) {
|
| bigintClass = loadClass("_Bigint", compiler.coreLibrary)?.element;
|
| uint32DigitsClass =
|
| loadClass("_Uint32Digits", compiler.coreLibrary)?.element;
|
| }
|
| growableListClass =
|
| - loadClass(growableListName, fletchSystemLibrary)?.element;
|
| - fletchNoSuchMethodErrorClass =
|
| - loadClass(fletchNoSuchMethodErrorName,
|
| - fletchSystemLibrary,
|
| + loadClass(growableListName, dartinoSystemLibrary)?.element;
|
| + dartinoNoSuchMethodErrorClass =
|
| + loadClass(dartinoNoSuchMethodErrorName,
|
| + dartinoSystemLibrary,
|
| builtin: true)?.element;
|
|
|
| // This class is optional.
|
| - coroutineClass = fletchSystemLibrary.implementation.find("Coroutine");
|
| + coroutineClass = dartinoSystemLibrary.implementation.find("Coroutine");
|
| if (coroutineClass != null) {
|
| coroutineClass.ensureResolved(compiler.resolution);
|
| }
|
| @@ -487,7 +487,7 @@ class FletchBackend extends Backend
|
|
|
| void onElementResolved(Element element, TreeElements elements) {
|
| if (alwaysEnqueue.contains(element)) {
|
| - var registry = new FletchRegistry(compiler);
|
| + var registry = new DartinoRegistry(compiler);
|
| if (element.isStatic || element.isTopLevel) {
|
| registry.registerStaticUse(new StaticUse.foreignUse(element));
|
| } else {
|
| @@ -505,11 +505,11 @@ class FletchBackend extends Backend
|
| /// compile-time constant instance of [patchAnnotationClass].
|
| ClassElement get patchAnnotationClass {
|
| // TODO(ahe): Introduce a proper constant class to identify constants. For
|
| - // now, we simply put "const patch = "patch";" in fletch._system.
|
| + // now, we simply put "const patch = "patch";" in dartino._system.
|
| return super.stringImplementation;
|
| }
|
|
|
| - FletchClassBuilder createClosureClass(
|
| + DartinoClassBuilder createClosureClass(
|
| FunctionElement closure,
|
| ClosureEnvironment closureEnvironment) {
|
| return closureClasses.putIfAbsent(closure, () {
|
| @@ -533,8 +533,8 @@ class FletchBackend extends Backend
|
| * If [function] is an instance member, the class will have one field, the
|
| * instance.
|
| */
|
| - FletchClassBuilder createTearoffClass(FletchFunctionBase function) {
|
| - FletchClassBuilder tearoffClass =
|
| + DartinoClassBuilder createTearoffClass(DartinoFunctionBase function) {
|
| + DartinoClassBuilder tearoffClass =
|
| systemBuilder.getTearoffClassBuilder(function, compiledClosureClass);
|
| if (tearoffClass != null) return tearoffClass;
|
| FunctionSignature signature = function.signature;
|
| @@ -544,7 +544,7 @@ class FletchBackend extends Backend
|
| signature.parameterCount,
|
| compiledClosureClass);
|
|
|
| - FletchFunctionBuilder functionBuilder =
|
| + DartinoFunctionBuilder functionBuilder =
|
| systemBuilder.newTearOff(function, tearoffClass.classId);
|
|
|
| BytecodeAssembler assembler = functionBuilder.assembler;
|
| @@ -573,10 +573,10 @@ class FletchBackend extends Backend
|
|
|
| String symbol = context.getCallSymbol(signature);
|
| int id = context.getSymbolId(symbol);
|
| - int fletchSelector = FletchSelector.encodeMethod(
|
| + int dartinoSelector = DartinoSelector.encodeMethod(
|
| id,
|
| signature.parameterCount);
|
| - tearoffClass.addToMethodTable(fletchSelector, functionBuilder);
|
| + tearoffClass.addToMethodTable(dartinoSelector, functionBuilder);
|
|
|
| if (!function.isInstanceMember) return tearoffClass;
|
|
|
| @@ -585,13 +585,13 @@ class FletchBackend extends Backend
|
| if (classElement == null) return tearoffClass;
|
|
|
| // Create == function that tests for equality.
|
| - int isSelector = context.toFletchTearoffIsSelector(
|
| + int isSelector = context.toDartinoTearoffIsSelector(
|
| function.name,
|
| classElement);
|
| tearoffClass.addIsSelector(isSelector);
|
|
|
| - FletchFunctionBuilder equal = systemBuilder.newFunctionBuilder(
|
| - FletchFunctionKind.NORMAL,
|
| + DartinoFunctionBuilder equal = systemBuilder.newFunctionBuilder(
|
| + DartinoFunctionKind.NORMAL,
|
| 2);
|
|
|
| BytecodeLabel isFalse = new BytecodeLabel();
|
| @@ -616,21 +616,21 @@ class FletchBackend extends Backend
|
| ..methodEnd();
|
|
|
| id = context.getSymbolId("==");
|
| - int equalsSelector = FletchSelector.encodeMethod(id, 1);
|
| + int equalsSelector = DartinoSelector.encodeMethod(id, 1);
|
| tearoffClass.addToMethodTable(equalsSelector, equal);
|
|
|
| // Create hashCode getter. We simply add the object hashCode and the
|
| // method id of the tearoff'ed function.
|
| - FletchFunctionBuilder hashCode = systemBuilder.newFunctionBuilder(
|
| - FletchFunctionKind.ACCESSOR,
|
| + DartinoFunctionBuilder hashCode = systemBuilder.newFunctionBuilder(
|
| + DartinoFunctionKind.ACCESSOR,
|
| 1);
|
|
|
| - int hashCodeSelector = FletchSelector.encodeGetter(
|
| + int hashCodeSelector = DartinoSelector.encodeGetter(
|
| context.getSymbolId("hashCode"));
|
|
|
| // TODO(ajohnsen): Use plus, we plus is always enqueued. Consider using
|
| // xor when we have a way to enqueue it from here.
|
| - int plusSelector = FletchSelector.encodeMethod(
|
| + int plusSelector = DartinoSelector.encodeMethod(
|
| context.getSymbolId("+"), 1);
|
|
|
| hashCode.assembler
|
| @@ -647,14 +647,14 @@ class FletchBackend extends Backend
|
| return tearoffClass;
|
| }
|
|
|
| - FletchFunctionBase getFunctionForElement(FunctionElement element) {
|
| + DartinoFunctionBase getFunctionForElement(FunctionElement element) {
|
| assert(element.memberContext == element);
|
|
|
| - FletchFunctionBase function =
|
| + DartinoFunctionBase function =
|
| systemBuilder.lookupFunctionByElement(element);
|
| if (function != null) return function;
|
|
|
| - return createFletchFunctionBuilder(element);
|
| + return createDartinoFunctionBuilder(element);
|
| }
|
|
|
| /// Get the constructor initializer function for [constructor]. The function
|
| @@ -662,40 +662,40 @@ class FletchBackend extends Backend
|
| ///
|
| /// See [compilePendingConstructorInitializers] for an overview of
|
| /// constructor intializers and constructor bodies.
|
| - FletchFunctionBase getConstructorInitializerFunction(
|
| + DartinoFunctionBase getConstructorInitializerFunction(
|
| ConstructorElement constructor) {
|
| assert(constructor.isDeclaration);
|
| constructor = constructor.implementation;
|
| - FletchFunctionBase base =
|
| + DartinoFunctionBase base =
|
| systemBuilder.lookupConstructorInitializerByElement(constructor);
|
| if (base != null) return base;
|
|
|
| - FletchFunctionBuilder builder = systemBuilder.newConstructorInitializer(
|
| + DartinoFunctionBuilder builder = systemBuilder.newConstructorInitializer(
|
| constructor);
|
| pendingConstructorInitializers.addFirst(builder);
|
|
|
| return builder;
|
| }
|
|
|
| - FletchFunctionBuilder createFletchFunctionBuilder(FunctionElement function) {
|
| + DartinoFunctionBuilder createDartinoFunctionBuilder(FunctionElement function) {
|
| assert(function.memberContext == function);
|
|
|
| - FletchClassBuilder holderClass;
|
| + DartinoClassBuilder holderClass;
|
| if (function.isInstanceMember || function.isGenerativeConstructor) {
|
| ClassElement enclosingClass = function.enclosingClass.declaration;
|
| holderClass = registerClassElement(enclosingClass);
|
| }
|
| - return internalCreateFletchFunctionBuilder(
|
| + return internalCreateDartinoFunctionBuilder(
|
| function,
|
| function.name,
|
| holderClass);
|
| }
|
|
|
| - FletchFunctionBuilder internalCreateFletchFunctionBuilder(
|
| + DartinoFunctionBuilder internalCreateDartinoFunctionBuilder(
|
| FunctionElement function,
|
| String name,
|
| - FletchClassBuilder holderClass) {
|
| - FletchFunctionBuilder functionBuilder =
|
| + DartinoClassBuilder holderClass) {
|
| + DartinoFunctionBuilder functionBuilder =
|
| systemBuilder.lookupFunctionBuilderByElement(function.declaration);
|
| if (functionBuilder != null) return functionBuilder;
|
|
|
| @@ -709,18 +709,18 @@ class FletchBackend extends Backend
|
| implementation.functionSignature,
|
| memberOf,
|
| kind: function.isAccessor
|
| - ? FletchFunctionKind.ACCESSOR
|
| - : FletchFunctionKind.NORMAL,
|
| + ? DartinoFunctionKind.ACCESSOR
|
| + : DartinoFunctionKind.NORMAL,
|
| mapByElement: function.declaration);
|
| }
|
|
|
| - ClassDebugInfo createClassDebugInfo(FletchClass klass) {
|
| + ClassDebugInfo createClassDebugInfo(DartinoClass klass) {
|
| return new ClassDebugInfo(klass);
|
| }
|
|
|
| DebugInfo createDebugInfo(
|
| - FletchFunction function,
|
| - FletchSystem currentSystem) {
|
| + DartinoFunction function,
|
| + DartinoSystem currentSystem) {
|
| DebugInfo debugInfo = new DebugInfo(function);
|
| AstElement element = function.element;
|
| if (element == null) return debugInfo;
|
| @@ -731,8 +731,8 @@ class FletchBackend extends Backend
|
| element,
|
| elements);
|
| CodegenVisitor codegen;
|
| - FletchFunctionBuilder builder =
|
| - new FletchFunctionBuilder.fromFletchFunction(function);
|
| + DartinoFunctionBuilder builder =
|
| + new DartinoFunctionBuilder.fromDartinoFunction(function);
|
| if (function.isLazyFieldInitializer) {
|
| codegen = new DebugInfoLazyFieldInitializerCodegen(
|
| debugInfo,
|
| @@ -745,7 +745,7 @@ class FletchBackend extends Backend
|
| } else if (function.isInitializerList) {
|
| ClassElement enclosingClass = element.enclosingClass;
|
| // TODO(ajohnsen): Don't depend on the class builder.
|
| - FletchClassBuilder classBuilder =
|
| + DartinoClassBuilder classBuilder =
|
| systemBuilder.lookupClassBuilderByElement(enclosingClass.declaration);
|
| codegen = new DebugInfoConstructorCodegen(
|
| debugInfo,
|
| @@ -791,13 +791,13 @@ class FletchBackend extends Backend
|
| "Method [codegen] not supported, use [compileElement] instead");
|
| }
|
|
|
| - /// Invoked by [FletchEnqueuer] once per element that needs to be compiled.
|
| + /// Invoked by [DartinoEnqueuer] once per element that needs to be compiled.
|
| ///
|
| /// This is used to generate the bytecodes for [declaration].
|
| void compileElement(
|
| AstElement declaration,
|
| TreeElements treeElements,
|
| - FletchRegistry registry) {
|
| + DartinoRegistry registry) {
|
| AstElement element = declaration.implementation;
|
| compiler.reporter.withCurrentElement(element, () {
|
| assert(declaration.isDeclaration);
|
| @@ -821,7 +821,7 @@ class FletchBackend extends Backend
|
| });
|
| }
|
|
|
| - /// Invoked by [FletchEnqueuer] once per [selector] that may invoke
|
| + /// Invoked by [DartinoEnqueuer] once per [selector] that may invoke
|
| /// [declaration].
|
| ///
|
| /// This is used to generate stubs for [declaration].
|
| @@ -829,7 +829,7 @@ class FletchBackend extends Backend
|
| AstElement declaration,
|
| Selector selector,
|
| TreeElements treeElements,
|
| - FletchRegistry registry) {
|
| + DartinoRegistry registry) {
|
| AstElement element = declaration.implementation;
|
| compiler.reporter.withCurrentElement(element, () {
|
| assert(declaration.isDeclaration);
|
| @@ -837,7 +837,7 @@ class FletchBackend extends Backend
|
| if (!element.isInstanceMember && !isLocalFunction(element)) {
|
| // No stub needed. Optional arguments are handled at call-site.
|
| } else if (element.isFunction) {
|
| - FletchFunctionBase function =
|
| + DartinoFunctionBase function =
|
| systemBuilder.lookupFunctionByElement(element.declaration);
|
| CallStructure callStructure = selector.callStructure;
|
| FunctionSignature signature = function.signature;
|
| @@ -867,7 +867,7 @@ class FletchBackend extends Backend
|
| });
|
| }
|
|
|
| - /// Invoked by [FletchEnqueuer] once per `call` [selector] that may invoke
|
| + /// Invoked by [DartinoEnqueuer] once per `call` [selector] that may invoke
|
| /// [declaration] as an implicit closure (for example, a tear-off).
|
| ///
|
| /// This is used to generate parameter stubs for the closures.
|
| @@ -875,7 +875,7 @@ class FletchBackend extends Backend
|
| AstElement declaration,
|
| Selector selector,
|
| TreeElements treeElements,
|
| - FletchRegistry registry,
|
| + DartinoRegistry registry,
|
| ClosureKind kind) {
|
| AstElement element = declaration.implementation;
|
| compiler.reporter.withCurrentElement(element, () {
|
| @@ -884,11 +884,11 @@ class FletchBackend extends Backend
|
| context.compiler.reportVerboseInfo(
|
| element, 'Need tear-off parameter stub $selector');
|
| }
|
| - FletchFunctionBase function =
|
| + DartinoFunctionBase function =
|
| systemBuilder.lookupFunctionByElement(element.declaration);
|
| if (function == null) {
|
| compiler.reporter.internalError(
|
| - element, "Has no fletch function, but used as tear-off");
|
| + element, "Has no dartino function, but used as tear-off");
|
| }
|
| if (selector.isGetter) {
|
| // This is a special tear-off getter.
|
| @@ -951,22 +951,22 @@ class FletchBackend extends Backend
|
| void codegenFunction(
|
| FunctionElement function,
|
| TreeElements elements,
|
| - FletchRegistry registry) {
|
| - registry.registerStaticUse(new StaticUse.foreignUse(fletchSystemEntry));
|
| + DartinoRegistry registry) {
|
| + registry.registerStaticUse(new StaticUse.foreignUse(dartinoSystemEntry));
|
|
|
| ClosureEnvironment closureEnvironment = createClosureEnvironment(
|
| function,
|
| elements);
|
|
|
| - FletchFunctionBuilder functionBuilder;
|
| + DartinoFunctionBuilder functionBuilder;
|
|
|
| if (function.memberContext != function) {
|
| - functionBuilder = internalCreateFletchFunctionBuilder(
|
| + functionBuilder = internalCreateDartinoFunctionBuilder(
|
| function,
|
| Identifiers.call,
|
| createClosureClass(function, closureEnvironment));
|
| } else {
|
| - functionBuilder = createFletchFunctionBuilder(function);
|
| + functionBuilder = createDartinoFunctionBuilder(function);
|
| }
|
|
|
| FunctionCodegen codegen = new FunctionCodegen(
|
| @@ -998,14 +998,14 @@ class FletchBackend extends Backend
|
| SelectorKind kind = SelectorKind.Method;
|
| if (function.isGetter) kind = SelectorKind.Getter;
|
| if (function.isSetter) kind = SelectorKind.Setter;
|
| - int fletchSelector = FletchSelector.encode(id, kind, arity);
|
| - FletchClassBuilder classBuilder =
|
| + int dartinoSelector = DartinoSelector.encode(id, kind, arity);
|
| + DartinoClassBuilder classBuilder =
|
| systemBuilder.lookupClassBuilder(functionBuilder.memberOf);
|
| - classBuilder.addToMethodTable(fletchSelector, functionBuilder);
|
| + classBuilder.addToMethodTable(dartinoSelector, functionBuilder);
|
| // Inject method into all mixin usages.
|
| getMixinApplicationsOfClass(classBuilder).forEach((ClassElement usage) {
|
| - FletchClassBuilder compiledUsage = registerClassElement(usage);
|
| - compiledUsage.addToMethodTable(fletchSelector, functionBuilder);
|
| + DartinoClassBuilder compiledUsage = registerClassElement(usage);
|
| + compiledUsage.addToMethodTable(dartinoSelector, functionBuilder);
|
| });
|
| }
|
|
|
| @@ -1015,7 +1015,7 @@ class FletchBackend extends Backend
|
| }
|
| }
|
|
|
| - List<ClassElement> getMixinApplicationsOfClass(FletchClassBuilder builder) {
|
| + List<ClassElement> getMixinApplicationsOfClass(DartinoClassBuilder builder) {
|
| ClassElement element = builder.element;
|
| if (element == null) return [];
|
| List<ClassElement> mixinUsage =
|
| @@ -1037,7 +1037,7 @@ class FletchBackend extends Backend
|
| ClassElement enclosingClass = function.enclosingClass;
|
| if (enclosingClass != null) name = '${enclosingClass.name}$name';
|
|
|
| - FletchNativeDescriptor descriptor = context.nativeDescriptors[name];
|
| + DartinoNativeDescriptor descriptor = context.nativeDescriptors[name];
|
| if (descriptor == null) {
|
| throw "Unsupported native function: $name";
|
| }
|
| @@ -1052,12 +1052,12 @@ class FletchBackend extends Backend
|
| FunctionElement coroutineStart =
|
| coroutineClass.lookupLocalMember("_coroutineStart");
|
| Selector selector = new Selector.fromElement(coroutineStart);
|
| - new FletchRegistry(compiler)
|
| + new DartinoRegistry(compiler)
|
| ..registerDynamicUse(selector);
|
| } else if (name == "Process._spawn") {
|
| // The native method `Process._spawn` will do a closure invoke with 0, 1,
|
| // or 2 arguments.
|
| - new FletchRegistry(compiler)
|
| + new DartinoRegistry(compiler)
|
| ..registerDynamicUse(new Selector.callClosure(0))
|
| ..registerDynamicUse(new Selector.callClosure(1))
|
| ..registerDynamicUse(new Selector.callClosure(2));
|
| @@ -1086,11 +1086,11 @@ class FletchBackend extends Backend
|
| void codegenExternalFunction(
|
| FunctionElement function,
|
| FunctionCodegen codegen) {
|
| - if (function == fletchExternalYield) {
|
| + if (function == dartinoExternalYield) {
|
| codegenExternalYield(function, codegen);
|
| } else if (function == context.compiler.identicalFunction.implementation) {
|
| codegenIdentical(function, codegen);
|
| - } else if (function == fletchExternalInvokeMain) {
|
| + } else if (function == dartinoExternalInvokeMain) {
|
| codegenExternalInvokeMain(function, codegen);
|
| } else if (function.name == noSuchMethodTrampolineName &&
|
| function.library == compiler.coreLibrary) {
|
| @@ -1147,7 +1147,7 @@ class FletchBackend extends Backend
|
| // src/vm/interpreter.cc:HandleEnterNoSuchMethod
|
| int id = context.getSymbolId(
|
| context.mangleName(new Name(noSuchMethodName, compiler.coreLibrary)));
|
| - int fletchSelector = FletchSelector.encodeMethod(id, 3);
|
| + int dartinoSelector = DartinoSelector.encodeMethod(id, 3);
|
| BytecodeLabel skipGetter = new BytecodeLabel();
|
| codegen.assembler
|
| ..enterNoSuchMethod(skipGetter)
|
| @@ -1158,7 +1158,7 @@ class FletchBackend extends Backend
|
| ..invokeSelector(1)
|
| ..exitNoSuchMethod()
|
| ..bind(skipGetter)
|
| - ..invokeMethod(fletchSelector, 1)
|
| + ..invokeMethod(dartinoSelector, 1)
|
| ..exitNoSuchMethod()
|
| ..methodEnd();
|
| }
|
| @@ -1167,7 +1167,7 @@ class FletchBackend extends Backend
|
| if (element is FunctionElement) {
|
| for (var metadata in element.metadata) {
|
| // TODO(ahe): This code should ensure that @native resolves to precisely
|
| - // the native variable in dart:fletch._system.
|
| + // the native variable in dart:dartino._system.
|
| if (metadata.constant == null) continue;
|
| ConstantValue value = context.getConstantValue(metadata.constant);
|
| if (!value.isString) continue;
|
| @@ -1200,27 +1200,27 @@ class FletchBackend extends Backend
|
| // TODO(ajohnsen): Use registry in CodegenVisitor to register the used
|
| // constants.
|
| FunctionElement function = value.element;
|
| - createTearoffClass(createFletchFunctionBuilder(function));
|
| + createTearoffClass(createDartinoFunctionBuilder(function));
|
| // Be sure to actually enqueue the function for compilation.
|
| - FletchRegistry registry = new FletchRegistry(compiler);
|
| + DartinoRegistry registry = new DartinoRegistry(compiler);
|
| registry.registerStaticUse(new StaticUse.foreignUse(function));
|
| }
|
|
|
| - FletchFunctionBase createParameterStub(
|
| - FletchFunctionBase function,
|
| + DartinoFunctionBase createParameterStub(
|
| + DartinoFunctionBase function,
|
| Selector selector) {
|
| CallStructure callStructure = selector.callStructure;
|
| assert(callStructure.signatureApplies(function.signature));
|
| ParameterStubSignature signature = new ParameterStubSignature(
|
| function.functionId, callStructure);
|
| - FletchFunctionBase stub = systemBuilder.lookupParameterStub(signature);
|
| + DartinoFunctionBase stub = systemBuilder.lookupParameterStub(signature);
|
| if (stub != null) return stub;
|
|
|
| int arity = selector.argumentCount;
|
| if (function.isInstanceMember) arity++;
|
|
|
| - FletchFunctionBuilder builder = systemBuilder.newFunctionBuilder(
|
| - FletchFunctionKind.PARAMETER_STUB,
|
| + DartinoFunctionBuilder builder = systemBuilder.newFunctionBuilder(
|
| + DartinoFunctionKind.PARAMETER_STUB,
|
| arity);
|
|
|
| BytecodeAssembler assembler = builder.assembler;
|
| @@ -1277,15 +1277,15 @@ class FletchBackend extends Backend
|
| ..methodEnd();
|
|
|
| if (function.isInstanceMember) {
|
| - int fletchSelector = context.toFletchSelector(selector);
|
| - FletchClassBuilder classBuilder = getClassBuilderOfExistingClass(function.memberOf);
|
| - classBuilder.addToMethodTable(fletchSelector, builder);
|
| + int dartinoSelector = context.toDartinoSelector(selector);
|
| + DartinoClassBuilder classBuilder = getClassBuilderOfExistingClass(function.memberOf);
|
| + classBuilder.addToMethodTable(dartinoSelector, builder);
|
|
|
| // Inject parameter stub into all mixin usages.
|
| getMixinApplicationsOfClass(classBuilder).forEach((ClassElement usage) {
|
| - FletchClassBuilder classBuilder =
|
| + DartinoClassBuilder classBuilder =
|
| systemBuilder.lookupClassBuilderByElement(usage);
|
| - classBuilder.addToMethodTable(fletchSelector, builder);
|
| + classBuilder.addToMethodTable(dartinoSelector, builder);
|
| });
|
| }
|
|
|
| @@ -1301,13 +1301,13 @@ class FletchBackend extends Backend
|
| /// a class with a `call` method [ClosureKind.functionLike]) and that the
|
| /// getter should be added to that class.
|
| void createTearoffGetterForFunction(
|
| - FletchFunctionBuilder function,
|
| + DartinoFunctionBuilder function,
|
| {bool isSpecialCallMethod}) {
|
| if (isSpecialCallMethod == null) {
|
| throw new ArgumentError("isSpecialCallMethod");
|
| }
|
| - FletchFunctionBuilder getter = systemBuilder.newFunctionBuilder(
|
| - FletchFunctionKind.ACCESSOR,
|
| + DartinoFunctionBuilder getter = systemBuilder.newFunctionBuilder(
|
| + DartinoFunctionKind.ACCESSOR,
|
| 1);
|
| // If the getter is of 'call', return the instance instead.
|
| if (isSpecialCallMethod) {
|
| @@ -1316,7 +1316,7 @@ class FletchBackend extends Backend
|
| ..ret()
|
| ..methodEnd();
|
| } else {
|
| - FletchClassBuilder tearoffClass = createTearoffClass(function);
|
| + DartinoClassBuilder tearoffClass = createTearoffClass(function);
|
| int constId = getter.allocateConstantFromClass(tearoffClass.classId);
|
| getter.assembler
|
| ..loadParameter(0)
|
| @@ -1332,38 +1332,38 @@ class FletchBackend extends Backend
|
| }
|
| // TODO(sigurdm): Avoid allocating new name here.
|
| Name name = new Name(function.name, library);
|
| - int fletchSelector = context.toFletchSelector(
|
| + int dartinoSelector = context.toDartinoSelector(
|
| new Selector.getter(name));
|
| - FletchClassBuilder classBuilder = systemBuilder.lookupClassBuilder(
|
| + DartinoClassBuilder classBuilder = systemBuilder.lookupClassBuilder(
|
| function.memberOf);
|
| - classBuilder.addToMethodTable(fletchSelector, getter);
|
| + classBuilder.addToMethodTable(dartinoSelector, getter);
|
|
|
| // Inject getter into all mixin usages.
|
| getMixinApplicationsOfClass(classBuilder).forEach((ClassElement usage) {
|
| - FletchClassBuilder classBuilder =
|
| + DartinoClassBuilder classBuilder =
|
| systemBuilder.lookupClassBuilderByElement(usage);
|
| - classBuilder.addToMethodTable(fletchSelector, getter);
|
| + classBuilder.addToMethodTable(dartinoSelector, getter);
|
| });
|
| }
|
|
|
| void compileTypeTest(ClassElement element, InterfaceType type) {
|
| assert(element.isDeclaration);
|
| - int fletchSelector = context.toFletchIsSelector(type.element);
|
| - FletchClassBuilder builder =
|
| + int dartinoSelector = context.toDartinoIsSelector(type.element);
|
| + DartinoClassBuilder builder =
|
| systemBuilder.lookupClassBuilderByElement(element);
|
| if (builder != null) {
|
| context.compiler.reportVerboseInfo(
|
| element, 'Adding is-selector for $type');
|
| - builder.addIsSelector(fletchSelector);
|
| + builder.addIsSelector(dartinoSelector);
|
| }
|
| }
|
|
|
| int assembleProgram() => 0;
|
|
|
| - FletchDelta computeDelta() {
|
| + DartinoDelta computeDelta() {
|
|
|
| - if (fletchSystemLibrary == null && compiler.compilationFailed) {
|
| - // TODO(ahe): Ensure fletchSystemLibrary is not null.
|
| + if (dartinoSystemLibrary == null && compiler.compilationFailed) {
|
| + // TODO(ahe): Ensure dartinoSystemLibrary is not null.
|
| return null;
|
| }
|
|
|
| @@ -1373,14 +1373,14 @@ class FletchBackend extends Backend
|
| const NewMap(MapId.constants),
|
| ];
|
|
|
| - FletchSystem system = systemBuilder.computeSystem(context, commands);
|
| + DartinoSystem system = systemBuilder.computeSystem(context, commands);
|
|
|
| commands.add(const PushNewInteger(0));
|
| commands.add(new PushFromMap(
|
| MapId.methods,
|
| - system.lookupFunctionByElement(fletchSystemEntry).functionId));
|
| + system.lookupFunctionByElement(dartinoSystemEntry).functionId));
|
|
|
| - return new FletchDelta(system, systemBuilder.predecessorSystem, commands);
|
| + return new DartinoDelta(system, systemBuilder.predecessorSystem, commands);
|
| }
|
|
|
| bool enableCodegenWithErrorsIfSupported(Spannable spannable) {
|
| @@ -1410,20 +1410,20 @@ class FletchBackend extends Backend
|
| if (library.isPlatformLibrary) {
|
| String path = library.canonicalUri.path;
|
| switch(path) {
|
| - case 'fletch._system':
|
| - fletchSystemLibrary = library;
|
| + case 'dartino._system':
|
| + dartinoSystemLibrary = library;
|
| break;
|
| - case 'fletch.ffi':
|
| - fletchFFILibrary = library;
|
| + case 'dartino.ffi':
|
| + dartinoFFILibrary = library;
|
| break;
|
| - case 'fletch.collection':
|
| + case 'dartino.collection':
|
| collectionLibrary = library;
|
| break;
|
| case 'math':
|
| mathLibrary = library;
|
| break;
|
| - case 'fletch':
|
| - fletchLibrary = library;
|
| + case 'dartino':
|
| + dartinoLibrary = library;
|
| break;
|
| }
|
|
|
| @@ -1439,13 +1439,13 @@ class FletchBackend extends Backend
|
| }
|
|
|
| bool isBackendLibrary(LibraryElement library) {
|
| - return library == fletchSystemLibrary;
|
| + return library == dartinoSystemLibrary;
|
| }
|
|
|
| /// Return non-null to enable patching. Possible return values are 'new' and
|
| /// 'old'. Referring to old and new emitter. Since the new emitter is the
|
| /// future, we assume 'old' will go away. So it seems the best option for
|
| - /// Fletch is 'new'.
|
| + /// Dartino is 'new'.
|
| String get patchVersion => 'new';
|
|
|
| FunctionElement resolveExternalFunction(FunctionElement element) {
|
| @@ -1458,7 +1458,7 @@ class FletchBackend extends Backend
|
| element = patch;
|
| // TODO(ahe): Don't use ensureResolved (fix TODO in isNative instead).
|
| element.metadata.forEach((m) => m.ensureResolved(compiler.resolution));
|
| - } else if (element.library == fletchSystemLibrary) {
|
| + } else if (element.library == dartinoSystemLibrary) {
|
| // Nothing needed for now.
|
| } else if (element.library == compiler.coreLibrary) {
|
| // Nothing needed for now.
|
| @@ -1466,7 +1466,7 @@ class FletchBackend extends Backend
|
| // Nothing needed for now.
|
| } else if (element.library == asyncLibrary) {
|
| // Nothing needed for now.
|
| - } else if (element.library == fletchLibrary) {
|
| + } else if (element.library == dartinoLibrary) {
|
| // Nothing needed for now.
|
| } else if (externals.contains(element)) {
|
| // Nothing needed for now.
|
| @@ -1479,15 +1479,15 @@ class FletchBackend extends Backend
|
|
|
| int compileLazyFieldInitializer(
|
| FieldElement field,
|
| - FletchRegistry registry) {
|
| + DartinoRegistry registry) {
|
| int index = context.getStaticFieldIndex(field, null);
|
|
|
| if (field.initializer == null) return index;
|
|
|
| if (lazyFieldInitializers.containsKey(field)) return index;
|
|
|
| - FletchFunctionBuilder functionBuilder = systemBuilder.newFunctionBuilder(
|
| - FletchFunctionKind.LAZY_FIELD_INITIALIZER,
|
| + DartinoFunctionBuilder functionBuilder = systemBuilder.newFunctionBuilder(
|
| + DartinoFunctionKind.LAZY_FIELD_INITIALIZER,
|
| 0,
|
| name: "${field.name} lazy initializer",
|
| element: field);
|
| @@ -1516,7 +1516,7 @@ class FletchBackend extends Backend
|
| ///
|
| /// See [compilePendingConstructorInitializers] for an overview of how
|
| /// constructor initializer and bodies are compiled.
|
| - void compileConstructorInitializer(FletchFunctionBuilder functionBuilder) {
|
| + void compileConstructorInitializer(DartinoFunctionBuilder functionBuilder) {
|
| ConstructorElement constructor = functionBuilder.element;
|
| assert(constructor.isImplementation);
|
| compiler.reporter.withCurrentElement(constructor, () {
|
| @@ -1530,9 +1530,9 @@ class FletchBackend extends Backend
|
| // TODO(ahe): We shouldn't create a registry, but we have to as long as
|
| // the enqueuer doesn't support elements with more than one compilation
|
| // artifact.
|
| - FletchRegistry registry = new FletchRegistry(compiler);
|
| + DartinoRegistry registry = new DartinoRegistry(compiler);
|
|
|
| - FletchClassBuilder classBuilder =
|
| + DartinoClassBuilder classBuilder =
|
| registerClassElement(constructor.enclosingClass.declaration);
|
|
|
| ClosureEnvironment closureEnvironment =
|
| @@ -1573,7 +1573,7 @@ class FletchBackend extends Backend
|
| void generateUnimplementedError(
|
| Spannable spannable,
|
| String reason,
|
| - FletchFunctionBuilder function,
|
| + DartinoFunctionBuilder function,
|
| {bool suppressHint: false}) {
|
| if (!suppressHint) {
|
| compiler.reporter.reportHintMessage(
|
| @@ -1602,7 +1602,7 @@ class FletchBackend extends Backend
|
| void newElement(Element element) {
|
| if (element.isField && element.isInstanceMember) {
|
| forEachSubclassOf(element.enclosingClass, (ClassElement cls) {
|
| - FletchClassBuilder builder = registerClassElement(cls);
|
| + DartinoClassBuilder builder = registerClassElement(cls);
|
| builder.addField(element);
|
| });
|
| }
|
| @@ -1618,7 +1618,7 @@ class FletchBackend extends Backend
|
| // TODO(ahe): The front-end should remove the element from
|
| // elementsWithCompileTimeErrors.
|
| compiler.elementsWithCompileTimeErrors.remove(element);
|
| - FletchFunctionBase function =
|
| + DartinoFunctionBase function =
|
| systemBuilder.lookupFunctionByElement(element);
|
| if (function == null) return;
|
| systemBuilder.forgetFunction(function);
|
| @@ -1628,25 +1628,25 @@ class FletchBackend extends Backend
|
| if (!element.isInstanceMember) return;
|
| ClassElement enclosingClass = element.enclosingClass;
|
| forEachSubclassOf(enclosingClass, (ClassElement cls) {
|
| - FletchClassBuilder builder = registerClassElement(cls);
|
| + DartinoClassBuilder builder = registerClassElement(cls);
|
| builder.removeField(element);
|
| });
|
| }
|
|
|
| void removeFunction(FunctionElement element) {
|
| - FletchFunctionBase function =
|
| + DartinoFunctionBase function =
|
| systemBuilder.lookupFunctionByElement(element);
|
| if (function == null) return;
|
| if (element.isInstanceMember) {
|
| ClassElement enclosingClass = element.enclosingClass;
|
| - FletchClassBuilder builder = registerClassElement(enclosingClass);
|
| + DartinoClassBuilder builder = registerClassElement(enclosingClass);
|
| builder.removeFromMethodTable(function);
|
| }
|
| }
|
|
|
| /// Invoked during codegen enqueuing to compile constructor initializers.
|
| ///
|
| - /// There's only one [Element] representing a constructor, but Fletch uses
|
| + /// There's only one [Element] representing a constructor, but Dartino uses
|
| /// two different functions for implementing a constructor.
|
| ///
|
| /// The first function takes care of allocating the instance and initializing
|
| @@ -1679,7 +1679,7 @@ class FletchBackend extends Backend
|
| return true;
|
| }
|
|
|
| - FletchEnqueueTask makeEnqueuer() => new FletchEnqueueTask(compiler);
|
| + DartinoEnqueueTask makeEnqueuer() => new DartinoEnqueueTask(compiler);
|
|
|
| static bool isExactParameterMatch(
|
| FunctionSignature signature,
|
| @@ -1712,8 +1712,8 @@ class FletchBackend extends Backend
|
| return true;
|
| }
|
|
|
| - static FletchBackend createInstance(FletchCompilerImplementation compiler) {
|
| - return new FletchBackend(compiler);
|
| + static DartinoBackend createInstance(DartinoCompilerImplementation compiler) {
|
| + return new DartinoBackend(compiler);
|
| }
|
|
|
| Uri resolvePatchUri(String libraryName, Uri libraryRoot) {
|
| @@ -1722,10 +1722,10 @@ class FletchBackend extends Backend
|
|
|
| }
|
|
|
| -class FletchImpactTransformer extends ImpactTransformer {
|
| - final FletchBackend backend;
|
| +class DartinoImpactTransformer extends ImpactTransformer {
|
| + final DartinoBackend backend;
|
|
|
| - FletchImpactTransformer(this.backend);
|
| + DartinoImpactTransformer(this.backend);
|
|
|
| @override
|
| WorldImpact transformResolutionImpact(ResolutionImpact worldImpact) {
|
|
|