1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef QQMLJSFUNCTIONINITIALIAZER_P_H |
5 | #define QQMLJSFUNCTIONINITIALIAZER_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | |
17 | #include <private/qqmljscompilepass_p.h> |
18 | |
19 | QT_BEGIN_NAMESPACE |
20 | |
21 | class Q_QMLCOMPILER_PRIVATE_EXPORT QQmlJSFunctionInitializer |
22 | { |
23 | Q_DISABLE_COPY_MOVE(QQmlJSFunctionInitializer) |
24 | public: |
25 | QQmlJSFunctionInitializer( |
26 | const QQmlJSTypeResolver *typeResolver, |
27 | const QV4::CompiledData::Location &objectLocation, |
28 | const QV4::CompiledData::Location &scopeLocation) |
29 | : m_typeResolver(typeResolver) |
30 | , m_scopeType(typeResolver->scopeForLocation(location: scopeLocation)) |
31 | , m_objectType(typeResolver->scopeForLocation(location: objectLocation)) |
32 | {} |
33 | |
34 | QQmlJSCompilePass::Function run( |
35 | const QV4::Compiler::Context *context, |
36 | const QString &propertyName, QQmlJS::AST::Node *astNode, |
37 | const QmlIR::Binding &irBinding, |
38 | QQmlJS::DiagnosticMessage *error); |
39 | QQmlJSCompilePass::Function run( |
40 | const QV4::Compiler::Context *context, |
41 | const QString &functionName, QQmlJS::AST::Node *astNode, |
42 | QQmlJS::DiagnosticMessage *error); |
43 | |
44 | private: |
45 | void populateSignature( |
46 | const QV4::Compiler::Context *context, QQmlJS::AST::FunctionExpression *ast, |
47 | QQmlJSCompilePass::Function *function, QQmlJS::DiagnosticMessage *error); |
48 | |
49 | const QQmlJSTypeResolver *m_typeResolver = nullptr; |
50 | const QQmlJSScope::ConstPtr m_scopeType; |
51 | const QQmlJSScope::ConstPtr m_objectType; |
52 | }; |
53 | |
54 | QT_END_NAMESPACE |
55 | |
56 | #endif // QQMLJSFUNCTIONINITIALIZER_P_H |
57 | |