| Index: pkg/dartino_compiler/lib/dartino_system.dart
|
| diff --git a/pkg/fletchc/lib/fletch_system.dart b/pkg/dartino_compiler/lib/dartino_system.dart
|
| similarity index 66%
|
| rename from pkg/fletchc/lib/fletch_system.dart
|
| rename to pkg/dartino_compiler/lib/dartino_system.dart
|
| index 233a8668ac431ff225c85bfef2c36d6ae1da1f00..a7903bc4f71c362dff76ef42570a0cedfca4455f 100644
|
| --- a/pkg/fletchc/lib/fletch_system.dart
|
| +++ b/pkg/dartino_compiler/lib/dartino_system.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_system;
|
| +library dartino_compiler.dartino_system;
|
|
|
| import 'package:compiler/src/constants/values.dart' show
|
| ConstantValue;
|
| @@ -23,13 +23,13 @@ import 'package:persistent/persistent.dart' show
|
| import 'bytecodes.dart';
|
| import 'vm_commands.dart';
|
|
|
| -import 'src/fletch_selector.dart' show
|
| - FletchSelector;
|
| +import 'src/dartino_selector.dart' show
|
| + DartinoSelector;
|
|
|
| -import 'src/fletch_system_printer.dart' show
|
| - FletchSystemPrinter;
|
| +import 'src/dartino_system_printer.dart' show
|
| + DartinoSystemPrinter;
|
|
|
| -enum FletchFunctionKind {
|
| +enum DartinoFunctionKind {
|
| NORMAL,
|
| LAZY_FIELD_INITIALIZER,
|
| INITIALIZER_LIST,
|
| @@ -38,16 +38,16 @@ enum FletchFunctionKind {
|
| }
|
|
|
| // TODO(ajohnsen): Move to separate file.
|
| -class FletchConstant {
|
| +class DartinoConstant {
|
| final int id;
|
| final MapId mapId;
|
| - const FletchConstant(this.id, this.mapId);
|
| + const DartinoConstant(this.id, this.mapId);
|
|
|
| - String toString() => "FletchConstant($id, $mapId)";
|
| + String toString() => "DartinoConstant($id, $mapId)";
|
| }
|
|
|
| // TODO(ajohnsen): Move to separate file.
|
| -class FletchClass {
|
| +class DartinoClass {
|
| final int classId;
|
| final String name;
|
| final ClassElement element;
|
| @@ -56,7 +56,7 @@ class FletchClass {
|
| final PersistentMap<int, int> methodTable;
|
| final List<FieldElement> fields;
|
|
|
| - const FletchClass(
|
| + const DartinoClass(
|
| this.classId,
|
| this.name,
|
| this.element,
|
| @@ -67,13 +67,13 @@ class FletchClass {
|
|
|
| bool get hasSuperclassId => superclassId >= 0;
|
|
|
| - String toString() => "FletchClass($classId, '$name')";
|
| + String toString() => "DartinoClass($classId, '$name')";
|
| }
|
|
|
| // TODO(ajohnsen): Move to separate file.
|
| -abstract class FletchFunctionBase {
|
| +abstract class DartinoFunctionBase {
|
| final int functionId;
|
| - final FletchFunctionKind kind;
|
| + final DartinoFunctionKind kind;
|
| // TODO(ajohnsen): Merge with function signature?
|
| final int arity;
|
| // TODO(ajohnsen): Remove name?
|
| @@ -81,7 +81,7 @@ abstract class FletchFunctionBase {
|
| final Element element;
|
|
|
| /**
|
| - * The signature of the FletchFunctionBuilder.
|
| + * The signature of the DartinoFunctionBuilder.
|
| *
|
| * Some compiled functions does not have a signature (for example, generated
|
| * accessors).
|
| @@ -89,7 +89,7 @@ abstract class FletchFunctionBase {
|
| final FunctionSignature signature;
|
| final int memberOf;
|
|
|
| - const FletchFunctionBase(
|
| + const DartinoFunctionBase(
|
| this.functionId,
|
| this.kind,
|
| this.arity,
|
| @@ -102,19 +102,19 @@ abstract class FletchFunctionBase {
|
| bool get isInternal => element == null;
|
|
|
| bool get isLazyFieldInitializer {
|
| - return kind == FletchFunctionKind.LAZY_FIELD_INITIALIZER;
|
| + return kind == DartinoFunctionKind.LAZY_FIELD_INITIALIZER;
|
| }
|
|
|
| bool get isInitializerList {
|
| - return kind == FletchFunctionKind.INITIALIZER_LIST;
|
| + return kind == DartinoFunctionKind.INITIALIZER_LIST;
|
| }
|
|
|
| bool get isAccessor {
|
| - return kind == FletchFunctionKind.ACCESSOR;
|
| + return kind == DartinoFunctionKind.ACCESSOR;
|
| }
|
|
|
| bool get isParameterStub {
|
| - return kind == FletchFunctionKind.PARAMETER_STUB;
|
| + return kind == DartinoFunctionKind.PARAMETER_STUB;
|
| }
|
|
|
| bool get isConstructor => element != null && element.isConstructor;
|
| @@ -123,13 +123,13 @@ abstract class FletchFunctionBase {
|
| }
|
|
|
| // TODO(ajohnsen): Move to separate file.
|
| -class FletchFunction extends FletchFunctionBase {
|
| +class DartinoFunction extends DartinoFunctionBase {
|
| final List<Bytecode> bytecodes;
|
| - final List<FletchConstant> constants;
|
| + final List<DartinoConstant> constants;
|
|
|
| - const FletchFunction(
|
| + const DartinoFunction(
|
| int functionId,
|
| - FletchFunctionKind kind,
|
| + DartinoFunctionKind kind,
|
| int arity,
|
| String name,
|
| Element element,
|
| @@ -139,8 +139,8 @@ class FletchFunction extends FletchFunctionBase {
|
| int memberOf)
|
| : super(functionId, kind, arity, name, element, signature, memberOf);
|
|
|
| - FletchFunction withReplacedConstants(List<FletchConstant> constants) {
|
| - return new FletchFunction(
|
| + DartinoFunction withReplacedConstants(List<DartinoConstant> constants) {
|
| + return new DartinoFunction(
|
| functionId,
|
| kind,
|
| arity,
|
| @@ -153,15 +153,15 @@ class FletchFunction extends FletchFunctionBase {
|
| }
|
|
|
| /// Represents a function we have lost track off, for example, -1 in a
|
| - /// backtrace from the Fletch VM.
|
| - const FletchFunction.missing()
|
| + /// backtrace from the Dartino VM.
|
| + const DartinoFunction.missing()
|
| : this(
|
| - -1, FletchFunctionKind.NORMAL, 0, "<missing>", null, null,
|
| - const <Bytecode>[], const <FletchConstant>[], null);
|
| + -1, DartinoFunctionKind.NORMAL, 0, "<missing>", null, null,
|
| + const <Bytecode>[], const <DartinoConstant>[], null);
|
|
|
| String toString() {
|
| StringBuffer buffer = new StringBuffer();
|
| - buffer.write("FletchFunction($functionId, '$name'");
|
| + buffer.write("DartinoFunction($functionId, '$name'");
|
| if (isInstanceMember) {
|
| buffer.write(", memberOf=$memberOf");
|
| }
|
| @@ -175,7 +175,7 @@ class FletchFunction extends FletchFunctionBase {
|
| sb.writeln("Function $functionId, Arity=$arity");
|
| sb.writeln("Constants:");
|
| for (int i = 0; i < constants.length; i++) {
|
| - FletchConstant constant = constants[i];
|
| + DartinoConstant constant = constants[i];
|
| sb.writeln(" #$i: $constant");
|
| }
|
|
|
| @@ -201,34 +201,34 @@ class ParameterStubSignature {
|
| }
|
| }
|
|
|
| -class FletchSystem {
|
| +class DartinoSystem {
|
| // functionsByElement is a subset of functionsById: Some functions do not
|
| // have an element reference.
|
| - final PersistentMap<int, FletchFunction> functionsById;
|
| - final PersistentMap<Element, FletchFunction> functionsByElement;
|
| + final PersistentMap<int, DartinoFunction> functionsById;
|
| + final PersistentMap<Element, DartinoFunction> functionsByElement;
|
|
|
| - final PersistentMap<ConstructorElement, FletchFunction>
|
| + final PersistentMap<ConstructorElement, DartinoFunction>
|
| constructorInitializersByElement;
|
|
|
| final PersistentMap<int, int> tearoffsById;
|
|
|
| // classesByElement is a subset of classesById: Some classes do not
|
| // have an element reference.
|
| - final PersistentMap<int, FletchClass> classesById;
|
| - final PersistentMap<ClassElement, FletchClass> classesByElement;
|
| + final PersistentMap<int, DartinoClass> classesById;
|
| + final PersistentMap<ClassElement, DartinoClass> classesByElement;
|
|
|
| - final PersistentMap<int, FletchConstant> constantsById;
|
| - final PersistentMap<ConstantValue, FletchConstant> constantsByValue;
|
| + final PersistentMap<int, DartinoConstant> constantsById;
|
| + final PersistentMap<ConstantValue, DartinoConstant> constantsByValue;
|
|
|
| - final PersistentMap<int, String> symbolByFletchSelectorId;
|
| + final PersistentMap<int, String> symbolByDartinoSelectorId;
|
|
|
| final PersistentMap<int, int> gettersByFieldIndex;
|
|
|
| final PersistentMap<int, int> settersByFieldIndex;
|
|
|
| - final PersistentMap<ParameterStubSignature, FletchFunction> parameterStubs;
|
| + final PersistentMap<ParameterStubSignature, DartinoFunction> parameterStubs;
|
|
|
| - const FletchSystem(
|
| + const DartinoSystem(
|
| this.functionsById,
|
| this.functionsByElement,
|
| this.constructorInitializersByElement,
|
| @@ -237,44 +237,44 @@ class FletchSystem {
|
| this.classesByElement,
|
| this.constantsById,
|
| this.constantsByValue,
|
| - this.symbolByFletchSelectorId,
|
| + this.symbolByDartinoSelectorId,
|
| this.gettersByFieldIndex,
|
| this.settersByFieldIndex,
|
| this.parameterStubs);
|
|
|
| bool get isEmpty => functionsById.isEmpty;
|
|
|
| - String lookupSymbolBySelector(int fletchSelector) {
|
| - return symbolByFletchSelectorId[FletchSelector.decodeId(fletchSelector)];
|
| + String lookupSymbolBySelector(int dartinoSelector) {
|
| + return symbolByDartinoSelectorId[DartinoSelector.decodeId(dartinoSelector)];
|
| }
|
|
|
| - FletchFunction lookupFunctionById(int functionId) {
|
| + DartinoFunction lookupFunctionById(int functionId) {
|
| return functionsById[functionId];
|
| }
|
|
|
| - FletchFunction lookupFunctionByElement(Element element) {
|
| + DartinoFunction lookupFunctionByElement(Element element) {
|
| return functionsByElement[element];
|
| }
|
|
|
| - Iterable<FletchFunction> functionsWhere(bool f(FletchFunction function)) {
|
| + Iterable<DartinoFunction> functionsWhere(bool f(DartinoFunction function)) {
|
| return functionsById.values.where(f);
|
| }
|
|
|
| - FletchConstant lookupConstantById(int constantId) {
|
| + DartinoConstant lookupConstantById(int constantId) {
|
| return constantsById[constantId];
|
| }
|
|
|
| - FletchConstant lookupConstantByValue(ConstantValue value) {
|
| + DartinoConstant lookupConstantByValue(ConstantValue value) {
|
| return constantsByValue[value];
|
| }
|
|
|
| - FletchFunction lookupConstructorInitializerByElement(
|
| + DartinoFunction lookupConstructorInitializerByElement(
|
| ConstructorElement element) {
|
| return constructorInitializersByElement[element];
|
| }
|
|
|
| - /// Map from the ID of a [FletchFunction] to the ID of its corresponding
|
| - /// tear-off [FletchFunction].
|
| + /// Map from the ID of a [DartinoFunction] to the ID of its corresponding
|
| + /// tear-off [DartinoFunction].
|
| ///
|
| /// To obtain the tear-off corresponding to an [Element], look up the
|
| /// function in [functionsByElement].
|
| @@ -294,15 +294,15 @@ class FletchSystem {
|
| return settersByFieldIndex[fieldIndex];
|
| }
|
|
|
| - FletchClass lookupClassById(int classId) {
|
| + DartinoClass lookupClassById(int classId) {
|
| return classesById[classId];
|
| }
|
|
|
| - FletchClass lookupClassByElement(ClassElement element) {
|
| + DartinoClass lookupClassByElement(ClassElement element) {
|
| return classesByElement[element];
|
| }
|
|
|
| - FletchFunction lookupParameterStub(ParameterStubSignature signature) {
|
| + DartinoFunction lookupParameterStub(ParameterStubSignature signature) {
|
| return parameterStubs[signature];
|
| }
|
|
|
| @@ -315,14 +315,14 @@ class FletchSystem {
|
| }
|
|
|
| String toDebugString(Uri base) {
|
| - return new FletchSystemPrinter(this, base).generateDebugString();
|
| + return new DartinoSystemPrinter(this, base).generateDebugString();
|
| }
|
| }
|
|
|
| -class FletchDelta {
|
| - final FletchSystem system;
|
| - final FletchSystem predecessorSystem;
|
| +class DartinoDelta {
|
| + final DartinoSystem system;
|
| + final DartinoSystem predecessorSystem;
|
| final List<VmCommand> commands;
|
|
|
| - const FletchDelta(this.system, this.predecessorSystem, this.commands);
|
| + const DartinoDelta(this.system, this.predecessorSystem, this.commands);
|
| }
|
|
|