12void RuntimeCodegen::generateFromFunctionExpression(
13 const QString &sourceCode, AST::FunctionExpression *ast, Compiler::Module *module)
18 Compiler::ScanFunctions scan(
this, sourceCode, Compiler::ContextType::Global);
20 scan.enterEnvironment(
nullptr, Compiler::ContextType::Function, QString());
22 scan.leaveEnvironment();
27 int index = defineFunction(ast->name.toString(), ast, ast->formals, ast->body);
28 _module->rootContext = _module->functions.at(index);
31void RuntimeCodegen::throwSyntaxError(
const SourceLocation &loc,
const QString &detail)
36 Codegen::throwSyntaxError(loc, detail);
37 engine->throwSyntaxError(detail, _module->fileName, loc.startLine, loc.startColumn);
40void RuntimeCodegen::throwReferenceError(
const SourceLocation &loc,
const QString &detail)
45 Codegen::throwReferenceError(loc, detail);
46 engine->throwReferenceError(detail, _module->fileName, loc.startLine, loc.startColumn);