| Index: pkg/dartino_compiler/lib/src/dartino_function_builder.dart
|
| diff --git a/pkg/fletchc/lib/src/fletch_function_builder.dart b/pkg/dartino_compiler/lib/src/dartino_function_builder.dart
|
| similarity index 74%
|
| rename from pkg/fletchc/lib/src/fletch_function_builder.dart
|
| rename to pkg/dartino_compiler/lib/src/dartino_function_builder.dart
|
| index 57b570aeef513da2c4218890f9352c8693b29431..3c3a84fc7f3543ea87f09dea2535cc33bd6744ec 100644
|
| --- a/pkg/fletchc/lib/src/fletch_function_builder.dart
|
| +++ b/pkg/dartino_compiler/lib/src/dartino_function_builder.dart
|
| @@ -2,28 +2,28 @@
|
| // 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.compiled_function;
|
| +library dartino_compiler.compiled_function;
|
|
|
| import 'package:compiler/src/constants/values.dart' show
|
| ConstantValue;
|
|
|
| import 'package:compiler/src/elements/elements.dart';
|
|
|
| -import 'fletch_constants.dart' show
|
| - FletchFunctionConstant,
|
| - FletchClassConstant;
|
| +import 'dartino_constants.dart' show
|
| + DartinoFunctionConstant,
|
| + DartinoClassConstant;
|
|
|
| import '../bytecodes.dart' show
|
| Bytecode,
|
| Opcode;
|
|
|
| -import 'fletch_context.dart';
|
| +import 'dartino_context.dart';
|
| import 'bytecode_assembler.dart';
|
|
|
| -import '../fletch_system.dart';
|
| +import '../dartino_system.dart';
|
| import '../vm_commands.dart';
|
|
|
| -class FletchFunctionBuilder extends FletchFunctionBase {
|
| +class DartinoFunctionBuilder extends DartinoFunctionBase {
|
| final BytecodeAssembler assembler;
|
|
|
| /**
|
| @@ -37,7 +37,7 @@ class FletchFunctionBuilder extends FletchFunctionBase {
|
| final Map<int, ConstantValue> functionConstantValues = <int, ConstantValue>{};
|
| final Map<int, ConstantValue> classConstantValues = <int, ConstantValue>{};
|
|
|
| - FletchFunctionBuilder.fromFletchFunction(FletchFunction function)
|
| + DartinoFunctionBuilder.fromDartinoFunction(DartinoFunction function)
|
| : this(
|
| function.functionId,
|
| function.kind,
|
| @@ -46,9 +46,9 @@ class FletchFunctionBuilder extends FletchFunctionBase {
|
| element: function.element,
|
| memberOf: function.memberOf);
|
|
|
| - FletchFunctionBuilder(
|
| + DartinoFunctionBuilder(
|
| int functionId,
|
| - FletchFunctionKind kind,
|
| + DartinoFunctionKind kind,
|
| int arity,
|
| {String name,
|
| Element element,
|
| @@ -73,22 +73,22 @@ class FletchFunctionBuilder extends FletchFunctionBase {
|
| }
|
|
|
| int allocateConstantFromFunction(int functionId) {
|
| - FletchFunctionConstant constant =
|
| + DartinoFunctionConstant constant =
|
| functionConstantValues.putIfAbsent(
|
| - functionId, () => new FletchFunctionConstant(functionId));
|
| + functionId, () => new DartinoFunctionConstant(functionId));
|
| return allocateConstant(constant);
|
| }
|
|
|
| int allocateConstantFromClass(int classId) {
|
| - FletchClassConstant constant =
|
| + DartinoClassConstant constant =
|
| classConstantValues.putIfAbsent(
|
| - classId, () => new FletchClassConstant(classId));
|
| + classId, () => new DartinoClassConstant(classId));
|
| return allocateConstant(constant);
|
| }
|
|
|
| // TODO(ajohnsen): Remove this function when usage is avoided in
|
| - // FletchBackend.
|
| - void copyFrom(FletchFunctionBuilder function) {
|
| + // DartinoBackend.
|
| + void copyFrom(DartinoFunctionBuilder function) {
|
| assembler.bytecodes.addAll(function.assembler.bytecodes);
|
| assembler.catchRanges.addAll(function.assembler.catchRanges);
|
| constants.addAll(function.constants);
|
| @@ -96,8 +96,8 @@ class FletchFunctionBuilder extends FletchFunctionBase {
|
| classConstantValues.addAll(function.classConstantValues);
|
| }
|
|
|
| - FletchFunction finalizeFunction(
|
| - FletchContext context,
|
| + DartinoFunction finalizeFunction(
|
| + DartinoContext context,
|
| List<VmCommand> commands) {
|
| int constantCount = constants.length;
|
| for (int i = 0; i < constantCount; i++) {
|
| @@ -115,7 +115,7 @@ class FletchFunctionBuilder extends FletchFunctionBase {
|
|
|
| commands.add(new PopToMap(MapId.methods, functionId));
|
|
|
| - return new FletchFunction(
|
| + return new DartinoFunction(
|
| functionId,
|
| kind,
|
| arity,
|
| @@ -123,35 +123,35 @@ class FletchFunctionBuilder extends FletchFunctionBase {
|
| element,
|
| signature,
|
| assembler.bytecodes,
|
| - createFletchConstants(context),
|
| + createDartinoConstants(context),
|
| memberOf);
|
| }
|
|
|
| - List<FletchConstant> createFletchConstants(FletchContext context) {
|
| - List<FletchConstant> fletchConstants = <FletchConstant>[];
|
| + List<DartinoConstant> createDartinoConstants(DartinoContext context) {
|
| + List<DartinoConstant> dartinoConstants = <DartinoConstant>[];
|
|
|
| constants.forEach((constant, int index) {
|
| if (constant is ConstantValue) {
|
| - if (constant is FletchFunctionConstant) {
|
| - fletchConstants.add(
|
| - new FletchConstant(constant.functionId, MapId.methods));
|
| - } else if (constant is FletchClassConstant) {
|
| - fletchConstants.add(
|
| - new FletchConstant(constant.classId, MapId.classes));
|
| + if (constant is DartinoFunctionConstant) {
|
| + dartinoConstants.add(
|
| + new DartinoConstant(constant.functionId, MapId.methods));
|
| + } else if (constant is DartinoClassConstant) {
|
| + dartinoConstants.add(
|
| + new DartinoConstant(constant.classId, MapId.classes));
|
| } else {
|
| int id = context.lookupConstantIdByValue(constant);
|
| if (id == null) {
|
| throw "Unsupported constant: ${constant.toStructuredString()}";
|
| }
|
| - fletchConstants.add(
|
| - new FletchConstant(id, MapId.constants));
|
| + dartinoConstants.add(
|
| + new DartinoConstant(id, MapId.constants));
|
| }
|
| } else {
|
| throw "Unsupported constant: ${constant.runtimeType}";
|
| }
|
| });
|
|
|
| - return fletchConstants;
|
| + return dartinoConstants;
|
| }
|
|
|
| String verboseToString() {
|
|
|