use of com.github.anba.es6draft.compiler.assembler.Code.MethodCode in project es6draft by anba.
the class FunctionDeclarationInstantiationGenerator method generate.
void generate(FunctionNode function) {
MethodCode method = codegen.newMethod(function, FunctionName.Init);
CodeVisitor mv = new FunctionDeclInitMethodGenerator(method, function, targetType(function));
mv.lineInfo(function);
mv.begin();
mv.enterScope(function);
generate(function, mv);
mv.exitScope();
mv.end();
}
use of com.github.anba.es6draft.compiler.assembler.Code.MethodCode in project es6draft by anba.
the class ModuleDeclarationInstantiationGenerator method generate.
void generate(Module module, SourceTextModuleRecord moduleRecord) {
MethodCode method = codegen.newMethod(module, ModuleName.Init);
InstructionVisitor mv = new ModuleDeclInitMethodGenerator(method);
mv.lineInfo(module);
mv.begin();
generate(module, moduleRecord, mv);
mv.end();
}
use of com.github.anba.es6draft.compiler.assembler.Code.MethodCode in project es6draft by anba.
the class EvalDeclarationInstantiationGenerator method generate.
void generate(Script evalScript) {
MethodCode method = codegen.newMethod(evalScript, ScriptName.Init);
InstructionVisitor mv = new EvalDeclInitMethodGenerator(method);
mv.lineInfo(evalScript);
mv.begin();
if (VarDeclaredNames(evalScript).isEmpty() && LexicallyDeclaredNames(evalScript).isEmpty() && !hasBlockFunctions(evalScript)) {
mv._return();
} else if (evalScript.isScripting()) {
generateScripting(evalScript, mv);
} else if (evalScript.isStrict()) {
generateStrict(evalScript, mv);
} else if (evalScript.isGlobalCode()) {
generateGlobal(evalScript, mv);
} else {
generateFunction(evalScript, mv);
}
mv.end();
}
use of com.github.anba.es6draft.compiler.assembler.Code.MethodCode in project es6draft by anba.
the class FunctionCodeGenerator method generateConstruct.
private void generateConstruct(FunctionNode node, boolean tailCall) {
MethodCode method = codegen.newMethod(node, tailCall ? FunctionName.ConstructTailCall : FunctionName.Construct);
InstructionVisitor mv = new ConstructMethodGenerator(method, targetName(node), targetType(node));
mv.lineInfo(node);
mv.begin();
if (node.isGenerator()) {
generateGeneratorConstruct(node, mv);
} else if (isDerivedClassConstructor(node)) {
generateDerivedClassConstructorConstruct(node, tailCall, mv);
} else if (isLegacy(node)) {
generateLegacyFunctionConstruct(node, mv);
} else {
generateFunctionConstruct(node, tailCall, mv);
}
mv.end();
}
use of com.github.anba.es6draft.compiler.assembler.Code.MethodCode in project es6draft by anba.
the class FunctionCodeGenerator method generateCall.
private void generateCall(FunctionNode node) {
MethodCode method = codegen.newMethod(node, FunctionName.Call);
InstructionVisitor mv = new CallMethodGenerator(method, targetName(node), targetType(node));
mv.lineInfo(node);
mv.begin();
if (node.isAsync() && node.isGenerator()) {
generateAsyncGeneratorCall(node, mv);
} else if (node.isAsync()) {
generateAsyncFunctionCall(node, mv);
} else if (node.isGenerator()) {
if (node.isConstructor()) {
generateConstructorGeneratorCall(node, mv);
} else {
generateGeneratorCall(node, mv);
}
} else if (isClassConstructor(node)) {
generateClassConstructorCall(mv);
} else if (isLegacy(node)) {
generateLegacyFunctionCall(node, mv);
} else if (node.isConstructor()) {
generateFunctionCall(node, OrdinaryConstructorFunction.class, mv);
} else {
generateFunctionCall(node, OrdinaryFunction.class, mv);
}
mv.end();
}
Aggregations