Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant
4
5
#
include
"qv4engine_p.h"
6
#
include
"qv4runtimecodegen_p.h"
7
#
include
<
private
/
qv4compilerscanfunctions_p
.
h
>
8
9
using
namespace
QV4;
10
using
namespace
QQmlJS;
11
12
void
RuntimeCodegen::generateFromFunctionExpression(
13
const
QString &sourceCode, AST::FunctionExpression *ast, Compiler::Module *module)
14
{
15
_module = module;
16
_context =
nullptr
;
17
18
Compiler::ScanFunctions scan(
this
, sourceCode, Compiler::ContextType::Global);
19
// fake a global environment
20
scan.enterEnvironment(
nullptr
, Compiler::ContextType::Function, QString());
21
scan(ast);
22
scan.leaveEnvironment();
23
24
if
(hasError())
25
return
;
26
27
int
index = defineFunction(ast->name.toString(), ast, ast->formals, ast->body);
28
_module->rootContext = _module->functions.at(index);
29
}
30
31
void
RuntimeCodegen::throwSyntaxError(
const
SourceLocation &loc,
const
QString &detail)
32
{
33
if
(hasError())
34
return
;
35
36
Codegen::throwSyntaxError(loc, detail);
37
engine->throwSyntaxError(detail, _module->fileName, loc.startLine, loc.startColumn);
38
}
39
40
void
RuntimeCodegen::throwReferenceError(
const
SourceLocation &loc,
const
QString &detail)
41
{
42
if
(hasError())
43
return
;
44
45
Codegen::throwReferenceError(loc, detail);
46
engine->throwReferenceError(detail, _module->fileName, loc.startLine, loc.startColumn);
47
}
qtdeclarative
src
qml
jsruntime
qv4runtimecodegen.cpp
Generated on
for Qt by
1.18.0