Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | using namespace QQmlJS; | - |
5 | | - |
6 | namespace QV4 { | - |
7 | | - |
8 | namespace Moth { | - |
9 | struct Instruction; | - |
10 | } | - |
11 | | - |
12 | namespace CompiledData { | - |
13 | struct CompilationUnit; | - |
14 | } | - |
15 | | - |
16 | namespace Compiler { | - |
17 | | - |
18 | class Codegen; | - |
19 | | - |
20 | class ScanFunctions: protected QQmlJS::AST::Visitor | - |
21 | { | - |
22 | typedef QV4::TemporaryAssignment<bool> TemporaryBoolAssignment; | - |
23 | public: | - |
24 | ScanFunctions(Codegen *cg, const QString &sourceCode, ContextType defaultProgramType); | - |
25 | void operator()(AST::Node *node); | - |
26 | | - |
27 | void enterGlobalEnvironment(ContextType compilationMode); | - |
28 | void enterEnvironment(AST::Node *node, ContextType compilationMode, const QString &name); | - |
29 | void leaveEnvironment(); | - |
30 | | - |
31 | void enterQmlFunction(AST::FunctionDeclaration *ast) | - |
32 | { enterFunction(ast, false); } never executed: end of block | 0 |
33 | | - |
34 | protected: | - |
35 | using Visitor::visit; | - |
36 | using Visitor::endVisit; | - |
37 | | - |
38 | void checkDirectivePrologue(AST::StatementList *ast); | - |
39 | | - |
40 | void checkName(const QStringRef &name, const AST::SourceLocation &loc); | - |
41 | | - |
42 | bool visit(AST::Program *ast) override; | - |
43 | void endVisit(AST::Program *) override; | - |
44 | | - |
45 | bool visit(AST::CallExpression *ast) override; | - |
46 | bool visit(AST::PatternElement *ast) override; | - |
47 | bool visit(AST::IdentifierExpression *ast) override; | - |
48 | bool visit(AST::ExpressionStatement *ast) override; | - |
49 | bool visit(AST::FunctionExpression *ast) override; | - |
50 | bool visit(AST::TemplateLiteral *ast) override; | - |
51 | | - |
52 | bool enterFunction(AST::FunctionExpression *ast, bool enterName); | - |
53 | | - |
54 | void endVisit(AST::FunctionExpression *) override; | - |
55 | | - |
56 | bool visit(AST::ObjectPattern *ast) override; | - |
57 | | - |
58 | bool visit(AST::PatternProperty *ast) override; | - |
59 | void endVisit(AST::PatternProperty *) override; | - |
60 | | - |
61 | bool visit(AST::FunctionDeclaration *ast) override; | - |
62 | void endVisit(AST::FunctionDeclaration *) override; | - |
63 | | - |
64 | bool visit(AST::ClassExpression *ast) override; | - |
65 | void endVisit(AST::ClassExpression *) override; | - |
66 | | - |
67 | bool visit(AST::ClassDeclaration *ast) override; | - |
68 | void endVisit(AST::ClassDeclaration *) override; | - |
69 | | - |
70 | bool visit(AST::DoWhileStatement *ast) override; | - |
71 | bool visit(AST::ForStatement *ast) override; | - |
72 | void endVisit(AST::ForStatement *) override; | - |
73 | bool visit(AST::ForEachStatement *ast) override; | - |
74 | void endVisit(AST::ForEachStatement *) override; | - |
75 | | - |
76 | bool visit(AST::ThisExpression *ast) override; | - |
77 | | - |
78 | bool visit(AST::Block *ast) override; | - |
79 | void endVisit(AST::Block *ast) override; | - |
80 | | - |
81 | bool visit(AST::CaseBlock *ast) override; | - |
82 | void endVisit(AST::CaseBlock *ast) override; | - |
83 | | - |
84 | bool visit(AST::Catch *ast) override; | - |
85 | void endVisit(AST::Catch *ast) override; | - |
86 | | - |
87 | bool visit(AST::WithStatement *ast) override; | - |
88 | void endVisit(AST::WithStatement *ast) override; | - |
89 | | - |
90 | protected: | - |
91 | bool enterFunction(AST::Node *ast, const QString &name, AST::FormalParameterList *formals, AST::StatementList *body, bool enterName); | - |
92 | | - |
93 | void calcEscapingVariables(); | - |
94 | | - |
95 | Codegen *_cg; | - |
96 | const QString _sourceCode; | - |
97 | Context *_context; | - |
98 | QStack<Context *> _contextStack; | - |
99 | | - |
100 | bool _allowFuncDecls; | - |
101 | ContextType defaultProgramType; | - |
102 | | - |
103 | private: | - |
104 | static constexpr AST::Node *astNodeForGlobalEnvironment = nullptr; | - |
105 | }; | - |
106 | | - |
107 | } | - |
108 | | - |
109 | } | - |
110 | | - |
111 | | - |
| | |