|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef CPLUSPLUS_RESOLVEEXPRESSION_H |
|
43 #define CPLUSPLUS_RESOLVEEXPRESSION_H |
|
44 |
|
45 #include "LookupContext.h" |
|
46 |
|
47 #include <ASTVisitor.h> |
|
48 #include <Semantic.h> |
|
49 #include <FullySpecifiedType.h> |
|
50 |
|
51 namespace CPlusPlus { |
|
52 |
|
53 class CPLUSPLUS_EXPORT ResolveExpression: protected ASTVisitor |
|
54 { |
|
55 public: |
|
56 ResolveExpression(const LookupContext &context); |
|
57 virtual ~ResolveExpression(); |
|
58 |
|
59 QList<LookupItem> operator()(ExpressionAST *ast); |
|
60 |
|
61 QList<LookupItem> resolveMemberExpression(const QList<LookupItem> &baseResults, |
|
62 unsigned accessOp, |
|
63 const Name *memberName, |
|
64 bool *replacedDotOperator = 0) const; |
|
65 |
|
66 QList<LookupItem> resolveBaseExpression(const QList<LookupItem> &baseResults, |
|
67 int accessOp, |
|
68 bool *replacedDotOperator = 0) const; |
|
69 |
|
70 QList<LookupItem> resolveMember(const Name *memberName, Class *klass, |
|
71 const Name *className = 0) const; |
|
72 |
|
73 QList<LookupItem> resolveMember(const Name *memberName, ObjCClass *klass) const; |
|
74 |
|
75 protected: |
|
76 QList<LookupItem> switchResults(const QList<LookupItem> &symbols); |
|
77 |
|
78 void addResult(const FullySpecifiedType &ty, Symbol *symbol = 0); |
|
79 void addResult(const LookupItem &result); |
|
80 void addResults(const QList<LookupItem> &results); |
|
81 |
|
82 bool maybeValidPrototype(Function *funTy, unsigned actualArgumentCount) const; |
|
83 |
|
84 using ASTVisitor::visit; |
|
85 |
|
86 virtual bool visit(BinaryExpressionAST *ast); |
|
87 virtual bool visit(CastExpressionAST *ast); |
|
88 virtual bool visit(ConditionAST *ast); |
|
89 virtual bool visit(ConditionalExpressionAST *ast); |
|
90 virtual bool visit(CppCastExpressionAST *ast); |
|
91 virtual bool visit(DeleteExpressionAST *ast); |
|
92 virtual bool visit(ArrayInitializerAST *ast); |
|
93 virtual bool visit(NewExpressionAST *ast); |
|
94 virtual bool visit(TypeidExpressionAST *ast); |
|
95 virtual bool visit(TypenameCallExpressionAST *ast); |
|
96 virtual bool visit(TypeConstructorCallAST *ast); |
|
97 virtual bool visit(PostfixExpressionAST *ast); |
|
98 virtual bool visit(SizeofExpressionAST *ast); |
|
99 virtual bool visit(NumericLiteralAST *ast); |
|
100 virtual bool visit(BoolLiteralAST *ast); |
|
101 virtual bool visit(ThisExpressionAST *ast); |
|
102 virtual bool visit(NestedExpressionAST *ast); |
|
103 virtual bool visit(StringLiteralAST *ast); |
|
104 virtual bool visit(ThrowExpressionAST *ast); |
|
105 virtual bool visit(TypeIdAST *ast); |
|
106 virtual bool visit(UnaryExpressionAST *ast); |
|
107 virtual bool visit(CompoundLiteralAST *ast); |
|
108 |
|
109 //names |
|
110 virtual bool visit(QualifiedNameAST *ast); |
|
111 virtual bool visit(OperatorFunctionIdAST *ast); |
|
112 virtual bool visit(ConversionFunctionIdAST *ast); |
|
113 virtual bool visit(SimpleNameAST *ast); |
|
114 virtual bool visit(DestructorNameAST *ast); |
|
115 virtual bool visit(TemplateIdAST *ast); |
|
116 |
|
117 // postfix expressions |
|
118 virtual bool visit(CallAST *ast); |
|
119 virtual bool visit(ArrayAccessAST *ast); |
|
120 virtual bool visit(PostIncrDecrAST *ast); |
|
121 virtual bool visit(MemberAccessAST *ast); |
|
122 |
|
123 // Objective-C expressions |
|
124 virtual bool visit(ObjCMessageExpressionAST *ast); |
|
125 |
|
126 QList<Scope *> visibleScopes(const LookupItem &result) const; |
|
127 |
|
128 private: |
|
129 LookupContext _context; |
|
130 Semantic sem; |
|
131 QList<LookupItem> _results; |
|
132 Symbol *_declSymbol; |
|
133 }; |
|
134 |
|
135 class CPLUSPLUS_EXPORT ResolveClass |
|
136 { |
|
137 public: |
|
138 ResolveClass(); |
|
139 |
|
140 QList<Symbol *> operator()(const Name *name, |
|
141 const LookupItem &p, |
|
142 const LookupContext &context); |
|
143 |
|
144 private: |
|
145 QList<Symbol *> resolveClass(const Name *name, |
|
146 const LookupItem &p, |
|
147 const LookupContext &context); |
|
148 |
|
149 private: |
|
150 QList<LookupItem> _blackList; |
|
151 }; |
|
152 |
|
153 class CPLUSPLUS_EXPORT ResolveObjCClass |
|
154 { |
|
155 public: |
|
156 ResolveObjCClass(); |
|
157 |
|
158 QList<Symbol *> operator()(const Name *name, |
|
159 const LookupItem &p, |
|
160 const LookupContext &context); |
|
161 }; |
|
162 |
|
163 |
|
164 } // end of namespace CPlusPlus |
|
165 |
|
166 #endif // CPLUSPLUS_RESOLVEEXPRESSION_H |