Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | #ifndef QV4COMPILERSCANFUNCTIONS_P_H | - |
40 | #define QV4COMPILERSCANFUNCTIONS_P_H | - |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | | - |
47 | | - |
48 | | - |
49 | | - |
50 | | - |
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 | | - |
62 | QT_BEGIN_NAMESPACE | - |
63 | | - |
64 | using namespace QQmlJS; | - |
65 | | - |
66 | namespace QV4 { | - |
67 | | - |
68 | namespace Moth { | - |
69 | struct Instruction; | - |
70 | } | - |
71 | | - |
72 | namespace CompiledData { | - |
73 | struct CompilationUnit; | - |
74 | } | - |
75 | | - |
76 | namespace Compiler { | - |
77 | | - |
78 | class Codegen; | - |
79 | | - |
80 | class ScanFunctions: protected QQmlJS::AST::Visitor | - |
81 | { | - |
82 | typedef QV4::TemporaryAssignment<bool> TemporaryBoolAssignment; | - |
83 | public: | - |
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 | | - |
94 | protected: | - |
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 | | - |
150 | protected: | - |
151 | bool enterFunction(AST::Node *ast, const QString &name, AST::FormalParameterList *formals, AST::StatementList *body, bool enterName); | - |
152 | | - |
153 | void calcEscapingVariables(); | - |
154 | | - |
155 | Codegen *_cg; | - |
156 | const QString _sourceCode; | - |
157 | Context *_context; | - |
158 | QStack<Context *> _contextStack; | - |
159 | | - |
160 | bool _allowFuncDecls; | - |
161 | ContextType defaultProgramType; | - |
162 | | - |
163 | private: | - |
164 | static constexpr AST::Node *astNodeForGlobalEnvironment = nullptr; | - |
165 | }; | - |
166 | | - |
167 | } | - |
168 | | - |
169 | } | - |
170 | | - |
171 | QT_END_NAMESPACE | - |
172 | | - |
173 | #endif // QV4CODEGEN_P_H | - |
| | |