Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qv4runtimecodegen.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qv4engine_p.h"
6#include <private/qv4compilerscanfunctions_p.h>
7
8using namespace QV4;
9using namespace QQmlJS;
10
12 const QString &sourceCode,
14 Compiler::Module *module)
15{
16 _module = module;
19 _context = nullptr;
20
22 // fake a global environment
24 scan(ast);
25 scan.leaveEnvironment();
26
27 if (hasError())
28 return;
29
30 int index = defineFunction(ast->name.toString(), ast, ast->formals, ast->body);
32}
33
35{
36 if (hasError())
37 return;
38
39 Codegen::throwSyntaxError(loc, detail);
41}
42
44{
45 if (hasError())
46 return;
47
48 Codegen::throwReferenceError(loc, detail);
50}
51
FormalParameterList * formals
QString toString() const
Returns a deep copy of this string view's data as a QString.
Definition qstring.h:1121
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
virtual int defineFunction(const QString &name, QQmlJS::AST::Node *ast, QQmlJS::AST::FormalParameterList *formals, QQmlJS::AST::StatementList *body)
void enterEnvironment(QQmlJS::AST::Node *node, ContextType compilationMode, const QString &name)
void generateFromFunctionExpression(const QString &fileName, const QString &sourceCode, QQmlJS::AST::FunctionExpression *ast, Compiler::Module *module)
void throwSyntaxError(const QQmlJS::SourceLocation &loc, const QString &detail) override
void throwReferenceError(const QQmlJS::SourceLocation &loc, const QString &detail) override
GLuint index
[2]
QList< Context * > functions
ReturnedValue throwReferenceError(const Value &value)
ReturnedValue throwSyntaxError(const QString &message)