Index: pkg/dartino_compiler/lib/src/codegen_visitor.dart |
diff --git a/pkg/fletchc/lib/src/codegen_visitor.dart b/pkg/dartino_compiler/lib/src/codegen_visitor.dart |
similarity index 96% |
rename from pkg/fletchc/lib/src/codegen_visitor.dart |
rename to pkg/dartino_compiler/lib/src/codegen_visitor.dart |
index cb450ac180cdf8aafbf7ad87ea9ba9994b344f29..e8704b938163c9ead155f694ca30540d8a72c3ad 100644 |
--- a/pkg/fletchc/lib/src/codegen_visitor.dart |
+++ b/pkg/dartino_compiler/lib/src/codegen_visitor.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.codegen_visitor; |
+library dartino_compiler.codegen_visitor; |
import 'package:compiler/src/resolution/semantic_visitor.dart'; |
@@ -42,32 +42,32 @@ import 'package:compiler/src/diagnostics/spannable.dart' show |
Spannable; |
import 'package:compiler/src/dart_types.dart'; |
-import 'fletch_context.dart'; |
+import 'dartino_context.dart'; |
-import 'fletch_backend.dart'; |
+import 'dartino_backend.dart'; |
-import 'fletch_constants.dart' show |
- FletchClassConstant, |
- FletchClassInstanceConstant; |
+import 'dartino_constants.dart' show |
+ DartinoClassConstant, |
+ DartinoClassInstanceConstant; |
-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_selector.dart'; |
+import 'dartino_selector.dart'; |
-import '../fletch_system.dart'; |
+import '../dartino_system.dart'; |
import 'closure_environment.dart'; |
-import '../incremental/fletchc_incremental.dart' show |
+import '../incremental/dartino_compiler_incremental.dart' show |
IncrementalCompilationFailed; // TODO(ahe): Remove this import. |
-import 'fletch_registry.dart' show |
+import 'dartino_registry.dart' show |
ClosureKind, |
- FletchRegistry; |
+ DartinoRegistry; |
import 'package:compiler/src/diagnostics/diagnostic_listener.dart' show |
DiagnosticMessage; |
@@ -242,13 +242,13 @@ abstract class CodegenVisitor |
static const int MAX_INT64 = (1 << 63) - 1; |
static const int MIN_INT64 = -(1 << 63); |
- final FletchContext context; |
+ final DartinoContext context; |
final ClosureEnvironment closureEnvironment; |
final ExecutableElement element; |
- final FletchFunctionBuilder functionBuilder; |
+ final DartinoFunctionBuilder functionBuilder; |
final Map<Element, LocalValue> scope = <Element, LocalValue>{}; |
@@ -332,7 +332,7 @@ abstract class CodegenVisitor |
} |
int allocateConstantClassInstance(int classId) { |
- var constant = new FletchClassInstanceConstant(classId); |
+ var constant = new DartinoClassInstanceConstant(classId); |
context.markConstantUsed(constant); |
return functionBuilder.allocateConstant(constant); |
} |
@@ -422,24 +422,24 @@ abstract class CodegenVisitor |
String symbol = context.getSymbolFromSelector(selector); |
int id = context.getSymbolId(symbol); |
int arity = selector.argumentCount; |
- int fletchSelector = FletchSelector.encodeMethod(id, arity); |
- assembler.invokeMethod(fletchSelector, arity, selector.name); |
+ int dartinoSelector = DartinoSelector.encodeMethod(id, arity); |
+ assembler.invokeMethod(dartinoSelector, arity, selector.name); |
} |
void invokeGetter(Node node, Name name) { |
registerDynamicUse(new Selector.getter(name)); |
String symbol = context.mangleName(name); |
int id = context.getSymbolId(symbol); |
- int fletchSelector = FletchSelector.encodeGetter(id); |
- assembler.invokeMethod(fletchSelector, 0); |
+ int dartinoSelector = DartinoSelector.encodeGetter(id); |
+ assembler.invokeMethod(dartinoSelector, 0); |
} |
void invokeSetter(Node node, Name name) { |
registerDynamicUse(new Selector.setter(name)); |
String symbol = context.mangleName(name); |
int id = context.getSymbolId(symbol); |
- int fletchSelector = FletchSelector.encodeSetter(id); |
- assembler.invokeMethod(fletchSelector, 1); |
+ int dartinoSelector = DartinoSelector.encodeSetter(id); |
+ assembler.invokeMethod(dartinoSelector, 1); |
} |
void invokeFactory(Node node, int constId, int arity) { |
@@ -481,13 +481,13 @@ abstract class CodegenVisitor |
assembler.branchIfTrue(ifTrue); |
} |
- FletchFunctionBase requireFunction(FunctionElement element) { |
+ DartinoFunctionBase requireFunction(FunctionElement element) { |
// TODO(johnniwinther): More precise use. |
registerStaticUse(new StaticUse.foreignUse(element)); |
return context.backend.getFunctionForElement(element); |
} |
- FletchFunctionBase requireConstructorInitializer( |
+ DartinoFunctionBase requireConstructorInitializer( |
ConstructorElement constructor) { |
assert(constructor.isGenerativeConstructor); |
registerInstantiatedClass(constructor.enclosingClass); |
@@ -497,7 +497,7 @@ abstract class CodegenVisitor |
void doStaticFunctionInvoke( |
Node node, |
- FletchFunctionBase function, |
+ DartinoFunctionBase function, |
NodeList arguments, |
CallStructure callStructure, |
{bool factoryInvoke: false}) { |
@@ -507,11 +507,11 @@ abstract class CodegenVisitor |
int arity; |
if (signature.hasOptionalParameters && |
signature.optionalParametersAreNamed) { |
- if (FletchBackend.isExactParameterMatch(signature, callStructure)) { |
+ if (DartinoBackend.isExactParameterMatch(signature, callStructure)) { |
functionId = function.functionId; |
} else if (callStructure.signatureApplies(signature)) { |
// TODO(ajohnsen): Inline parameter stub? |
- FletchFunctionBase stub = context.backend.createParameterStub( |
+ DartinoFunctionBase stub = context.backend.createParameterStub( |
function, |
callStructure.callSelector); |
functionId = stub.functionId; |
@@ -942,9 +942,9 @@ abstract class CodegenVisitor |
// the actual argument types. |
TypedefType typedefType = type; |
int arity = typedefType.element.functionSignature.parameterCount; |
- int fletchSelector = context.toFletchIsSelector( |
+ int dartinoSelector = context.toDartinoIsSelector( |
context.backend.compiler.coreClasses.functionClass, arity); |
- assembler.invokeTest(fletchSelector, 0); |
+ assembler.invokeTest(dartinoSelector, 0); |
return; |
} |
@@ -956,8 +956,8 @@ abstract class CodegenVisitor |
} |
Element element = type.element; |
- int fletchSelector = context.toFletchIsSelector(element); |
- assembler.invokeTest(fletchSelector, 0); |
+ int dartinoSelector = context.toDartinoIsSelector(element); |
+ assembler.invokeTest(dartinoSelector, 0); |
} |
void doIs( |
@@ -1024,8 +1024,8 @@ abstract class CodegenVisitor |
MethodElement function, |
_) { |
registerClosurization(function, ClosureKind.tearOff); |
- FletchFunctionBase target = requireFunction(function); |
- FletchClassBuilder classBuilder = |
+ DartinoFunctionBase target = requireFunction(function); |
+ DartinoClassBuilder classBuilder = |
context.backend.createTearoffClass(target); |
assert(classBuilder.fields == 0); |
int constId = allocateConstantClassInstance(classBuilder.classId); |
@@ -1066,7 +1066,7 @@ abstract class CodegenVisitor |
assembler.loadLiteralNull(); |
} |
- FletchFunctionBase base = requireFunction(function); |
+ DartinoFunctionBase base = requireFunction(function); |
int constId = functionBuilder.allocateConstantFromFunction(base.functionId); |
invokeStatic(node, constId, parameterCount); |
} |
@@ -1083,10 +1083,10 @@ abstract class CodegenVisitor |
} |
if (element.isExternal) { |
// Patch known functions directly. |
- if (element == context.backend.fletchExternalInvokeMain) { |
+ if (element == context.backend.dartinoExternalInvokeMain) { |
doMainCall(node, arguments); |
return; |
- } else if (element == context.backend.fletchExternalCoroutineChange) { |
+ } else if (element == context.backend.dartinoExternalCoroutineChange) { |
for (Node argument in arguments) { |
visitForValue(argument); |
} |
@@ -1096,7 +1096,7 @@ abstract class CodegenVisitor |
// TODO(ajohnsen): Define a known set of external functions we allow |
// calls to? |
} |
- FletchFunctionBase target = requireFunction(element); |
+ DartinoFunctionBase target = requireFunction(element); |
doStaticFunctionInvoke(node, target, arguments, callStructure); |
} |
@@ -1124,7 +1124,7 @@ abstract class CodegenVisitor |
void doSuperCall(Node node, FunctionElement function) { |
registerStaticUse(new StaticUse.foreignUse(function)); |
int arity = function.functionSignature.parameterCount + 1; |
- FletchFunctionBase base = requireFunction(function); |
+ DartinoFunctionBase base = requireFunction(function); |
int constId = functionBuilder.allocateConstantFromFunction(base.functionId); |
invokeStatic(node, constId, arity); |
} |
@@ -1144,8 +1144,8 @@ abstract class CodegenVisitor |
_) { |
registerClosurization(method, ClosureKind.superTearOff); |
loadThis(); |
- FletchFunctionBase target = requireFunction(method); |
- FletchClassBuilder classBuilder = |
+ DartinoFunctionBase target = requireFunction(method); |
+ DartinoClassBuilder classBuilder = |
context.backend.createTearoffClass(target); |
assert(classBuilder.fields == 1); |
int constId = functionBuilder.allocateConstantFromClass( |
@@ -1279,7 +1279,7 @@ abstract class CodegenVisitor |
int computeFieldIndex(FieldElement field) { |
ClassElement classElement = element.enclosingClass; |
int fieldIndex; |
- FletchClassBuilder classBuilder; |
+ DartinoClassBuilder classBuilder; |
do { |
// We need to find the mixin application of the class, where the field |
// is stored. Iterate until it's found. |
@@ -1458,7 +1458,7 @@ abstract class CodegenVisitor |
// TODO(ahe): Implement runtimeType. |
generateUnimplementedError( |
node, |
- "'runtimeType' isn't supported in Fletch. See https://goo.gl/ELH6Zc"); |
+ "'runtimeType' isn't supported in Dartino. See https://goo.gl/ELH6Zc"); |
applyVisitState(); |
return; |
} |
@@ -1701,7 +1701,7 @@ abstract class CodegenVisitor |
} |
// The default constructor is a redirecting factory constructor. Follow it. |
constructor = constructor.effectiveTarget; |
- FletchFunctionBase function = requireFunction(constructor.declaration); |
+ DartinoFunctionBase function = requireFunction(constructor.declaration); |
doStaticFunctionInvoke( |
node, |
function, |
@@ -2223,7 +2223,7 @@ abstract class CodegenVisitor |
ConstructorElement constructor, |
NodeList arguments, |
CallStructure callStructure) { |
- FletchFunctionBase function = requireConstructorInitializer(constructor); |
+ DartinoFunctionBase function = requireConstructorInitializer(constructor); |
doStaticFunctionInvoke(node, function, arguments, callStructure); |
} |
@@ -2307,7 +2307,7 @@ abstract class CodegenVisitor |
return; |
} |
// TODO(ahe): Remove ".declaration" when issue 23135 is fixed. |
- FletchFunctionBase function = requireFunction(constructor.declaration); |
+ DartinoFunctionBase function = requireFunction(constructor.declaration); |
doStaticFunctionInvoke( |
node, function, arguments, callStructure, factoryInvoke: true); |
applyVisitState(); |
@@ -2417,7 +2417,7 @@ abstract class CodegenVisitor |
} |
void doStaticGetterGet(Send node, FunctionElement getter) { |
- if (getter == context.backend.fletchExternalNativeError) { |
+ if (getter == context.backend.dartinoExternalNativeError) { |
assembler.loadSlot(0); |
return; |
} |
@@ -2427,7 +2427,7 @@ abstract class CodegenVisitor |
return; |
} |
- FletchFunctionBase base = requireFunction(getter); |
+ DartinoFunctionBase base = requireFunction(getter); |
int constId = functionBuilder.allocateConstantFromFunction(base.functionId); |
invokeStatic(node, constId, 0); |
} |
@@ -2457,7 +2457,7 @@ abstract class CodegenVisitor |
Node rhs, |
_) { |
visitForValue(rhs); |
- FletchFunctionBase base = requireFunction(setter); |
+ DartinoFunctionBase base = requireFunction(setter); |
int constId = functionBuilder.allocateConstantFromFunction(base.functionId); |
invokeStatic(node, constId, 1); |
applyVisitState(); |
@@ -2506,7 +2506,7 @@ abstract class CodegenVisitor |
int thisClosureIndex = pushCapturedVariables(function); |
bool needToStoreThisReference = thisClosureIndex >= 0; |
- FletchClassBuilder classBuilder = context.backend.createClosureClass( |
+ DartinoClassBuilder classBuilder = context.backend.createClosureClass( |
function, |
closureEnvironment); |
int classConstant = functionBuilder.allocateConstantFromClass( |
@@ -2515,7 +2515,7 @@ abstract class CodegenVisitor |
// NOTE: Currently we emit a storeField instruction in case a closure |
// captures itself. Changing fields makes it a mutable object. |
// We can therefore not allocate the object with `immutable = true`. |
- // TODO(fletchc-team): Could we restrict this limitation. |
+ // TODO(dartino_compiler-team): Could we restrict this limitation. |
bool immutable = !closureEnvironment.closures[function].free.any( |
closureEnvironment.shouldBeBoxed) && !needToStoreThisReference; |
@@ -3062,8 +3062,8 @@ abstract class CodegenVisitor |
new DartString.literal(name)); |
context.markConstantUsed(constString); |
assembler.loadConst(functionBuilder.allocateConstant(constString)); |
- FunctionElement function = context.backend.fletchUnresolved; |
- FletchFunctionBase base = requireFunction(function); |
+ FunctionElement function = context.backend.dartinoUnresolved; |
+ DartinoFunctionBase base = requireFunction(function); |
int constId = functionBuilder.allocateConstantFromFunction(base.functionId); |
assembler.invokeStatic(constId, 1); |
} |
@@ -3084,8 +3084,8 @@ abstract class CodegenVisitor |
void doCompileError(DiagnosticMessage errorMessage) { |
- FunctionElement function = context.backend.fletchCompileError; |
- FletchFunctionBase base = requireFunction(function); |
+ FunctionElement function = context.backend.dartinoCompileError; |
+ DartinoFunctionBase base = requireFunction(function); |
int constId = functionBuilder.allocateConstantFromFunction(base.functionId); |
String errorString = formatError(errorMessage); |
ConstantValue stringConstant = |
@@ -3245,9 +3245,9 @@ abstract class CodegenVisitor |
} |
} |
-abstract class FletchRegistryMixin { |
- FletchRegistry get registry; |
- FletchContext get context; |
+abstract class DartinoRegistryMixin { |
+ DartinoRegistry get registry; |
+ DartinoContext get context; |
void registerDynamicUse(Selector selector) { |
registry.registerDynamicUse(selector); |