OpenCoverage

qv4compilerscanfunctions_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/compiler/qv4compilerscanfunctions_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39#ifndef QV4COMPILERSCANFUNCTIONS_P_H-
40#define QV4COMPILERSCANFUNCTIONS_P_H-
41-
42//-
43// W A R N I N G-
44// --------------
45//-
46// This file is not part of the Qt API. It exists purely as an-
47// implementation detail. This header file may change from version to-
48// version without notice, or even be removed.-
49//-
50// We mean it.-
51//-
52-
53#include "private/qv4global_p.h"-
54#include <private/qqmljsastvisitor_p.h>-
55#include <private/qqmljsast_p.h>-
56#include <private/qqmljsengine_p.h>-
57#include <private/qv4compilercontext_p.h>-
58#include <private/qv4util_p.h>-
59#include <QtCore/QStringList>-
60#include <QStack>-
61-
62QT_BEGIN_NAMESPACE-
63-
64using namespace QQmlJS;-
65-
66namespace QV4 {-
67-
68namespace Moth {-
69struct Instruction;-
70}-
71-
72namespace CompiledData {-
73struct CompilationUnit;-
74}-
75-
76namespace Compiler {-
77-
78class Codegen;-
79-
80class ScanFunctions: protected QQmlJS::AST::Visitor-
81{-
82 typedef QV4::TemporaryAssignment<bool> TemporaryBoolAssignment;-
83public:-
84 ScanFunctions(Codegen *cg, const QString &sourceCode, ContextType defaultProgramType);-
85 void operator()(AST::Node *node);-
86-
87 void enterGlobalEnvironment(ContextType compilationMode);-
88 void enterEnvironment(AST::Node *node, ContextType compilationMode, const QString &name);-
89 void leaveEnvironment();-
90-
91 void enterQmlFunction(AST::FunctionDeclaration *ast)-
92 { enterFunction(ast, false); }
never executed: end of block
0
93-
94protected:-
95 using Visitor::visit;-
96 using Visitor::endVisit;-
97-
98 void checkDirectivePrologue(AST::StatementList *ast);-
99-
100 void checkName(const QStringRef &name, const AST::SourceLocation &loc);-
101-
102 bool visit(AST::Program *ast) override;-
103 void endVisit(AST::Program *) override;-
104-
105 bool visit(AST::CallExpression *ast) override;-
106 bool visit(AST::PatternElement *ast) override;-
107 bool visit(AST::IdentifierExpression *ast) override;-
108 bool visit(AST::ExpressionStatement *ast) override;-
109 bool visit(AST::FunctionExpression *ast) override;-
110 bool visit(AST::TemplateLiteral *ast) override;-
111-
112 bool enterFunction(AST::FunctionExpression *ast, bool enterName);-
113-
114 void endVisit(AST::FunctionExpression *) override;-
115-
116 bool visit(AST::ObjectPattern *ast) override;-
117-
118 bool visit(AST::PatternProperty *ast) override;-
119 void endVisit(AST::PatternProperty *) override;-
120-
121 bool visit(AST::FunctionDeclaration *ast) override;-
122 void endVisit(AST::FunctionDeclaration *) override;-
123-
124 bool visit(AST::ClassExpression *ast) override;-
125 void endVisit(AST::ClassExpression *) override;-
126-
127 bool visit(AST::ClassDeclaration *ast) override;-
128 void endVisit(AST::ClassDeclaration *) override;-
129-
130 bool visit(AST::DoWhileStatement *ast) override;-
131 bool visit(AST::ForStatement *ast) override;-
132 void endVisit(AST::ForStatement *) override;-
133 bool visit(AST::ForEachStatement *ast) override;-
134 void endVisit(AST::ForEachStatement *) override;-
135-
136 bool visit(AST::ThisExpression *ast) override;-
137-
138 bool visit(AST::Block *ast) override;-
139 void endVisit(AST::Block *ast) override;-
140-
141 bool visit(AST::CaseBlock *ast) override;-
142 void endVisit(AST::CaseBlock *ast) override;-
143-
144 bool visit(AST::Catch *ast) override;-
145 void endVisit(AST::Catch *ast) override;-
146-
147 bool visit(AST::WithStatement *ast) override;-
148 void endVisit(AST::WithStatement *ast) override;-
149-
150protected:-
151 bool enterFunction(AST::Node *ast, const QString &name, AST::FormalParameterList *formals, AST::StatementList *body, bool enterName);-
152-
153 void calcEscapingVariables();-
154// fields:-
155 Codegen *_cg;-
156 const QString _sourceCode;-
157 Context *_context;-
158 QStack<Context *> _contextStack;-
159-
160 bool _allowFuncDecls;-
161 ContextType defaultProgramType;-
162-
163private:-
164 static constexpr AST::Node *astNodeForGlobalEnvironment = nullptr;-
165};-
166-
167}-
168-
169}-
170-
171QT_END_NAMESPACE-
172-
173#endif // QV4CODEGEN_P_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0