source: trunk/tools/porting/src/ast.cpp@ 1168

Last change on this file since 1168 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 30.1 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2001-2004 Roberto Raggi
4** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5** All rights reserved.
6** Contact: Nokia Corporation ([email protected])
7**
8** This file is part of the qt3to4 porting application of the Qt Toolkit.
9**
10** $QT_BEGIN_LICENSE:LGPL$
11** Commercial Usage
12** Licensees holding valid Qt Commercial licenses may use this file in
13** accordance with the Qt Commercial License Agreement provided with the
14** Software or, alternatively, in accordance with the terms contained in
15** a written agreement between you and Nokia.
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 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Nokia gives you certain additional
26** rights. These rights are described in the Nokia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37** If you have questions regarding the use of this file, please contact
38** Nokia at [email protected].
39** $QT_END_LICENSE$
40**
41****************************************************************************/
42
43#include "ast.h"
44#include <QStringList>
45#include <stdio.h>
46
47QT_BEGIN_NAMESPACE
48
49int AST::N = 0;
50
51// ------------------------------------------------------------------------
52AST::AST(int startToken, int count)
53 : m_scope(0),
54 m_startToken(startToken),
55 m_endToken(startToken + count),
56 m_parent(0),
57 m_children(0)
58{
59 ++N;
60}
61
62void AST::setParent(AST *parent)
63{
64 if (m_parent)
65 m_parent->removeChild(this);
66
67 m_parent = parent;
68
69 if (m_parent)
70 m_parent->appendChild(this);
71}
72
73void AST::appendChild(AST *child)
74{
75 m_children = snoc(m_children, child, _pool);
76}
77
78void AST::removeChild(AST *child)
79{
80 fprintf(stderr, "AST::removeChild child: %p not implemented yet\n", child);
81}
82
83// ------------------------------------------------------------------------
84NameAST::NameAST()
85 : m_global(false), m_unqualifiedName(0), m_classOrNamespaceNameList(0)
86{
87}
88
89void NameAST::setGlobal(bool b)
90{
91 m_global = b;
92}
93
94void NameAST::setUnqualifiedName(ClassOrNamespaceNameAST *unqualifiedName)
95{
96 m_unqualifiedName = unqualifiedName;
97 if (m_unqualifiedName) m_unqualifiedName->setParent(this);
98}
99
100void NameAST::addClassOrNamespaceName(ClassOrNamespaceNameAST *classOrNamespaceName)
101{
102 if(!classOrNamespaceName)
103 return;
104
105 classOrNamespaceName->setParent(this);
106 m_classOrNamespaceNameList = snoc(m_classOrNamespaceNameList, classOrNamespaceName, _pool);
107}
108
109// ------------------------------------------------------------------------
110DeclarationAST::DeclarationAST()
111{
112}
113
114// ------------------------------------------------------------------------
115LinkageBodyAST::LinkageBodyAST()
116 : m_declarationList(0)
117{
118}
119
120void LinkageBodyAST::addDeclaration(DeclarationAST *ast)
121{
122 if(!ast)
123 return;
124
125 ast->setParent(this);
126 m_declarationList = snoc(m_declarationList, ast, _pool);
127}
128
129// ------------------------------------------------------------------------
130LinkageSpecificationAST::LinkageSpecificationAST()
131 : m_externType(0),
132 m_linkageBody(0),
133 m_declaration(0)
134{
135}
136
137void LinkageSpecificationAST::setExternType(AST *externType)
138{
139 m_externType = externType;
140 if (m_externType) m_externType->setParent(this);
141}
142
143void LinkageSpecificationAST::setLinkageBody(LinkageBodyAST *linkageBody)
144{
145 m_linkageBody = linkageBody;
146 if (m_linkageBody) m_linkageBody->setParent(this);
147}
148
149void LinkageSpecificationAST::setDeclaration(DeclarationAST *decl)
150{
151 m_declaration = decl;
152 if (m_declaration) m_declaration->setParent(this);
153}
154
155// ------------------------------------------------------------------------
156TranslationUnitAST::TranslationUnitAST()
157 : m_declarationList(0)
158{
159 //kdDebug(9007) << "++ TranslationUnitAST::TranslationUnitAST()" << endl;
160}
161
162void TranslationUnitAST::addDeclaration(DeclarationAST *ast)
163{
164 if(!ast)
165 return;
166
167 ast->setParent(this);
168 m_declarationList = snoc(m_declarationList, ast, _pool);
169}
170
171// ------------------------------------------------------------------------
172NamespaceAST::NamespaceAST()
173 : m_namespaceName(0),
174 m_linkageBody(0)
175{
176}
177
178void NamespaceAST::setNamespaceName(AST *namespaceName)
179{
180 m_namespaceName = namespaceName;
181 if (m_namespaceName) m_namespaceName->setParent(this);
182}
183
184void NamespaceAST::setLinkageBody(LinkageBodyAST *linkageBody)
185{
186 m_linkageBody = linkageBody;
187 if (m_linkageBody) m_linkageBody->setParent(this);
188}
189
190
191// ------------------------------------------------------------------------
192NamespaceAliasAST::NamespaceAliasAST()
193 : m_namespaceName(0),
194 m_aliasName(0)
195{
196}
197
198void NamespaceAliasAST::setNamespaceName(AST *namespaceName)
199{
200 m_namespaceName = namespaceName;
201 if (m_namespaceName) m_namespaceName->setParent(this);
202}
203
204void NamespaceAliasAST::setAliasName(NameAST *name)
205{
206 m_aliasName = name;
207 if (m_aliasName) m_aliasName->setParent(this);
208}
209
210// ------------------------------------------------------------------------
211UsingAST::UsingAST()
212 : m_typeName(0),
213 m_name(0)
214{
215}
216
217void UsingAST::setTypeName(AST *typeName)
218{
219 m_typeName = typeName;
220 if (m_typeName) m_typeName->setParent(this);
221}
222
223void UsingAST::setName(NameAST *name)
224{
225 m_name = name;
226 if (m_name) m_name->setParent(this);
227}
228
229// ------------------------------------------------------------------------
230UsingDirectiveAST::UsingDirectiveAST()
231 : m_name(0)
232{
233}
234
235void UsingDirectiveAST::setName(NameAST *name)
236{
237 m_name = name;
238 if (m_name) m_name->setParent(this);
239}
240
241TypedefAST::TypedefAST()
242 : m_typeSpec(0),
243 m_initDeclaratorList(0)
244{
245}
246
247void TypeSpecifierAST::setName(NameAST *name)
248{
249 m_name = name;
250 if (m_name) m_name->setParent(this);
251}
252
253void TypedefAST::setTypeSpec(TypeSpecifierAST *typeSpec)
254{
255 m_typeSpec = typeSpec;
256 if (m_typeSpec) m_typeSpec->setParent(this);
257}
258
259void TypedefAST::setInitDeclaratorList(InitDeclaratorListAST *initDeclaratorList)
260{
261 m_initDeclaratorList = initDeclaratorList;
262 if (m_initDeclaratorList) m_initDeclaratorList->setParent(this);
263}
264
265// ------------------------------------------------------------------------
266TemplateArgumentListAST::TemplateArgumentListAST()
267 : m_argumentList(0)
268{
269}
270
271void TemplateArgumentListAST::addArgument(AST *arg)
272{
273 if(!arg)
274 return;
275
276 arg->setParent(this);
277 m_argumentList = snoc(m_argumentList, arg, _pool);
278}
279
280// ------------------------------------------------------------------------
281TemplateDeclarationAST::TemplateDeclarationAST()
282 : m_exported(0),
283 m_templateParameterList(0),
284 m_declaration(0)
285{
286}
287
288void TemplateDeclarationAST::setExported(AST *exported)
289{
290 m_exported = exported;
291 if (m_exported) m_exported->setParent(this);
292}
293
294void TemplateDeclarationAST::setTemplateParameterList(TemplateParameterListAST *templateParameterList)
295{
296 m_templateParameterList = templateParameterList;
297 if (m_templateParameterList) m_templateParameterList->setParent(this);
298}
299
300void TemplateDeclarationAST::setDeclaration(DeclarationAST *declaration)
301{
302 m_declaration = declaration;
303 if (m_declaration) m_declaration->setParent(this);
304}
305
306// ------------------------------------------------------------------------
307ClassOrNamespaceNameAST::ClassOrNamespaceNameAST()
308 : m_name(0), m_templateArgumentList(0)
309{
310}
311
312void ClassOrNamespaceNameAST::setName(AST *name)
313{
314 m_name = name;
315 if (m_name) m_name->setParent(this);
316}
317
318void ClassOrNamespaceNameAST::setTemplateArgumentList(TemplateArgumentListAST *templateArgumentList)
319{
320 m_templateArgumentList = templateArgumentList;
321 if (m_templateArgumentList) m_templateArgumentList->setParent(this);
322}
323
324// ------------------------------------------------------------------------
325TypeSpecifierAST::TypeSpecifierAST()
326 : m_name(0), m_cvQualify(0), m_cv2Qualify(0)
327
328{
329}
330
331void TypeSpecifierAST::setCvQualify(AST *cvQualify)
332{
333 m_cvQualify = cvQualify;
334 if (m_cvQualify) m_cvQualify->setParent(this);
335}
336
337void TypeSpecifierAST::setCv2Qualify(AST *cv2Qualify)
338{
339 m_cv2Qualify = cv2Qualify;
340 if (m_cv2Qualify) m_cv2Qualify->setParent(this);
341}
342
343// ------------------------------------------------------------------------
344ClassSpecifierAST::ClassSpecifierAST()
345 : m_winDeclSpec(0),
346 m_classKey(0),
347 m_baseClause(0),
348 m_declarationList(0)
349{
350}
351
352void ClassSpecifierAST::setClassKey(AST *classKey)
353{
354 m_classKey = classKey;
355 if (m_classKey) m_classKey->setParent(this);
356}
357
358void ClassSpecifierAST::addDeclaration(DeclarationAST *declaration)
359{
360 if(!declaration)
361 return;
362
363 declaration->setParent(this);
364 m_declarationList = snoc(m_declarationList, declaration, _pool);
365}
366
367void ClassSpecifierAST::setBaseClause(BaseClauseAST *baseClause)
368{
369 m_baseClause = baseClause;
370 if (m_baseClause) m_baseClause->setParent(this);
371}
372
373// ------------------------------------------------------------------------
374EnumSpecifierAST::EnumSpecifierAST()
375 : m_enumeratorList(0)
376{
377}
378
379void EnumSpecifierAST::addEnumerator(EnumeratorAST *enumerator)
380{
381 if(!enumerator)
382 return;
383
384 enumerator->setParent(this);
385 m_enumeratorList = snoc(m_enumeratorList, enumerator, _pool);
386}
387
388
389// ------------------------------------------------------------------------
390ElaboratedTypeSpecifierAST::ElaboratedTypeSpecifierAST()
391 : m_kind(0)
392{
393}
394
395void ElaboratedTypeSpecifierAST::setKind(AST *kind)
396{
397 m_kind = kind;
398 if (m_kind) m_kind->setParent(this);
399}
400
401// ------------------------------------------------------------------------
402EnumeratorAST::EnumeratorAST()
403 : m_id(0),
404 m_expression(0)
405{
406}
407
408void EnumeratorAST::setId(AST *id)
409{
410 m_id = id;
411 if (m_id) m_id->setParent(this);
412}
413
414void EnumeratorAST::setExpression(AbstractExpressionAST *expression)
415{
416 m_expression = expression;
417 if (m_expression) m_expression->setParent(this);
418}
419
420// ------------------------------------------------------------------------
421BaseClauseAST::BaseClauseAST()
422 : m_baseSpecifierList(0)
423{
424}
425
426void BaseClauseAST::addBaseSpecifier(BaseSpecifierAST *baseSpecifier)
427{
428 if(!baseSpecifier)
429 return;
430
431 baseSpecifier->setParent(this);
432 m_baseSpecifierList = snoc(m_baseSpecifierList, baseSpecifier, _pool);
433}
434
435// ------------------------------------------------------------------------
436BaseSpecifierAST::BaseSpecifierAST()
437 : m_isVirtual(0), m_access(0), m_name(0)
438
439{
440}
441
442void BaseSpecifierAST::setIsVirtual(AST *isVirtual)
443{
444 m_isVirtual = isVirtual;
445 if (m_isVirtual) m_isVirtual->setParent(this);
446}
447
448void BaseSpecifierAST::setAccess(AST *access)
449{
450 m_access = access;
451 if (m_access) m_access->setParent(this);
452}
453
454void BaseSpecifierAST::setName(NameAST *name)
455{
456 m_name = name;
457 if (m_name) m_name->setParent(this);
458}
459
460// ------------------------------------------------------------------------
461SimpleDeclarationAST::SimpleDeclarationAST()
462 : m_functionSpecifier(0),
463 m_storageSpecifier(0),
464 m_typeSpec(0),
465 m_initDeclaratorList(0),
466 m_winDeclSpec(0)
467{
468}
469
470void SimpleDeclarationAST::setFunctionSpecifier(AST *functionSpecifier)
471{
472 m_functionSpecifier = functionSpecifier;
473 if (m_functionSpecifier) m_functionSpecifier->setParent(this);
474}
475
476void SimpleDeclarationAST::setStorageSpecifier(AST *storageSpecifier)
477{
478 m_storageSpecifier = storageSpecifier;
479 if (m_storageSpecifier) m_storageSpecifier->setParent(this);
480}
481
482void SimpleDeclarationAST::setTypeSpec(TypeSpecifierAST *typeSpec)
483{
484 m_typeSpec = typeSpec;
485 if (m_typeSpec) m_typeSpec->setParent(this);
486}
487
488void SimpleDeclarationAST::setInitDeclaratorList(InitDeclaratorListAST *initDeclaratorList)
489{
490 m_initDeclaratorList = initDeclaratorList;
491 if (m_initDeclaratorList) m_initDeclaratorList->setParent(this);
492}
493
494void SimpleDeclarationAST::setWinDeclSpec(AST *winDeclSpec)
495{
496 m_winDeclSpec = winDeclSpec;
497 if (m_winDeclSpec) m_winDeclSpec->setParent(this);
498}
499
500// ------------------------------------------------------------------------
501InitDeclaratorListAST::InitDeclaratorListAST()
502 : m_initDeclaratorList(0)
503{
504}
505
506void InitDeclaratorListAST::addInitDeclarator(InitDeclaratorAST *decl)
507{
508 if(!decl)
509 return;
510
511 decl->setParent(this);
512 m_initDeclaratorList = snoc(m_initDeclaratorList, decl, _pool);
513}
514
515// ------------------------------------------------------------------------
516DeclaratorAST::DeclaratorAST()
517 : m_ptrOpList(0),
518 m_subDeclarator(0),
519 m_declaratorId(0),
520 m_bitfieldInitialization(0),
521 m_arrayDimensionList(0),
522 m_parameterDeclarationClause(0),
523 m_constant(0),
524 m_exceptionSpecification(0)
525{
526}
527
528void DeclaratorAST::setSubDeclarator(DeclaratorAST *subDeclarator)
529{
530 m_subDeclarator = subDeclarator;
531 if (m_subDeclarator) m_subDeclarator->setParent(this);
532}
533
534void DeclaratorAST::setDeclaratorId(NameAST *declaratorId)
535{
536 m_declaratorId = declaratorId;
537 if (m_declaratorId) m_declaratorId->setParent(this);
538}
539
540void DeclaratorAST::setBitfieldInitialization(AST *bitfieldInitialization)
541{
542 m_bitfieldInitialization = bitfieldInitialization;
543 if (m_bitfieldInitialization) m_bitfieldInitialization->setParent(this);
544}
545
546void DeclaratorAST::addArrayDimension(AST *arrayDimension)
547{
548 if(!arrayDimension)
549 return;
550
551 arrayDimension->setParent(this);
552 m_arrayDimensionList = snoc(m_arrayDimensionList, arrayDimension, _pool);
553}
554
555void DeclaratorAST::setParameterDeclarationClause(ParameterDeclarationClauseAST *parameterDeclarationClause)
556{
557 m_parameterDeclarationClause = parameterDeclarationClause;
558 if (m_parameterDeclarationClause) m_parameterDeclarationClause->setParent(this);
559}
560
561void DeclaratorAST::setConstant(AST *constant)
562{
563 m_constant = constant;
564 if (m_constant) m_constant->setParent(this);
565}
566
567void DeclaratorAST::setExceptionSpecification(AST *exceptionSpecification)
568{
569 m_exceptionSpecification = exceptionSpecification;
570 if (m_exceptionSpecification) m_exceptionSpecification->setParent(this);
571}
572
573void DeclaratorAST::addPtrOp(AST *ptrOp)
574{
575 if(!ptrOp)
576 return;
577
578 ptrOp->setParent(this);
579 m_ptrOpList = snoc(m_ptrOpList, ptrOp, _pool);
580}
581
582// --------------------------------------------------------------------------
583InitDeclaratorAST::InitDeclaratorAST()
584 : m_declarator(0),
585 m_initializer(0)
586{
587}
588
589void InitDeclaratorAST::setDeclarator(DeclaratorAST *declarator)
590{
591 m_declarator = declarator;
592 if (m_declarator) m_declarator->setParent(this);
593}
594
595void InitDeclaratorAST::setInitializer(AST *initializer)
596{
597 m_initializer = initializer;
598 if (m_initializer) m_initializer->setParent(this);
599}
600
601// --------------------------------------------------------------------------
602FunctionDefinitionAST::FunctionDefinitionAST()
603 : m_functionSpecifier(0),
604 m_storageSpecifier(0),
605 m_typeSpec(0),
606 m_initDeclarator(0),
607 m_functionBody(0),
608 m_winDeclSpec(0)
609{
610}
611
612void FunctionDefinitionAST::setFunctionSpecifier(AST *functionSpecifier)
613{
614 m_functionSpecifier = functionSpecifier;
615 if (m_functionSpecifier) m_functionSpecifier->setParent(this);
616}
617
618void FunctionDefinitionAST::setStorageSpecifier(AST *storageSpecifier)
619{
620 m_storageSpecifier = storageSpecifier;
621 if (m_storageSpecifier) m_storageSpecifier->setParent(this);
622}
623
624void FunctionDefinitionAST::setTypeSpec(TypeSpecifierAST *typeSpec)
625{
626 m_typeSpec = typeSpec;
627 if (m_typeSpec) m_typeSpec->setParent(this);
628}
629
630void FunctionDefinitionAST::setInitDeclarator(InitDeclaratorAST *initDeclarator)
631{
632 m_initDeclarator = initDeclarator;
633 if (m_initDeclarator) m_initDeclarator->setParent(this);
634}
635
636void FunctionDefinitionAST::setFunctionBody(StatementListAST *functionBody)
637{
638 m_functionBody = functionBody;
639 if (m_functionBody) m_functionBody->setParent(this);
640}
641
642void FunctionDefinitionAST::setWinDeclSpec(AST *winDeclSpec)
643{
644 m_winDeclSpec = winDeclSpec;
645 if (m_winDeclSpec) m_winDeclSpec->setParent(this);
646}
647
648// --------------------------------------------------------------------------
649StatementListAST::StatementListAST()
650 : m_statementList(0)
651{
652}
653
654void StatementListAST::addStatement(StatementAST *statement)
655{
656 if(!statement)
657 return;
658
659 statement->setParent(this);
660 m_statementList = snoc(m_statementList, statement, _pool);
661}
662
663// --------------------------------------------------------------------------
664IfStatementAST::IfStatementAST()
665 : m_condition(0),
666 m_statement(0),
667 m_elseStatement(0)
668{
669}
670
671void IfStatementAST::setCondition(ConditionAST *condition)
672{
673 m_condition = condition;
674 if (m_condition) m_condition->setParent(this);
675}
676
677void IfStatementAST::setStatement(StatementAST *statement)
678{
679 m_statement = statement;
680 if (m_statement) m_statement->setParent(this);
681}
682
683void IfStatementAST::setElseStatement(StatementAST *elseStatement)
684{
685 m_elseStatement = elseStatement;
686 if (m_elseStatement) m_elseStatement->setParent(this);
687}
688
689// --------------------------------------------------------------------------
690WhileStatementAST::WhileStatementAST()
691 : m_condition(0),
692 m_statement(0)
693{
694}
695
696void WhileStatementAST::setCondition(ConditionAST *condition)
697{
698 m_condition = condition;
699 if (m_condition) m_condition->setParent(this);
700}
701
702void WhileStatementAST::setStatement(StatementAST *statement)
703{
704 m_statement = statement;
705 if (m_statement) m_statement->setParent(this);
706}
707
708// --------------------------------------------------------------------------
709DoStatementAST::DoStatementAST()
710 : m_condition(0),
711 m_statement(0)
712{
713}
714
715void DoStatementAST::setCondition(ConditionAST *condition)
716{
717 m_condition = condition;
718 if (m_condition) m_condition->setParent(this);
719}
720
721void DoStatementAST::setStatement(StatementAST *statement)
722{
723 m_statement = statement;
724 if (m_statement) m_statement->setParent(this);
725}
726
727// --------------------------------------------------------------------------
728ForStatementAST::ForStatementAST()
729 : m_condition(0),
730 m_initStatement(0),
731 m_statement(0),
732 m_expression(0)
733{
734}
735
736void ForStatementAST::setCondition(ConditionAST *condition)
737{
738 m_condition = condition;
739 if (m_condition) m_condition->setParent(this);
740}
741
742void ForStatementAST::setExpression(AbstractExpressionAST *expression)
743{
744 m_expression = expression;
745 if (m_expression) m_expression->setParent(this);
746}
747
748void ForStatementAST::setStatement(StatementAST *statement)
749{
750 m_statement = statement;
751 if (m_statement) m_statement->setParent(this);
752}
753
754void ForStatementAST::setInitStatement(StatementAST *initStatement)
755{
756 m_initStatement = initStatement;
757 if (m_initStatement) m_initStatement->setParent(this);
758}
759
760// --------------------------------------------------------------------------
761SwitchStatementAST::SwitchStatementAST()
762 : m_condition(0),
763 m_statement(0)
764{
765}
766
767void SwitchStatementAST::setCondition(ConditionAST *condition)
768{
769 m_condition = condition;
770 if (m_condition) m_condition->setParent(this);
771}
772
773void SwitchStatementAST::setStatement(StatementAST *statement)
774{
775 m_statement = statement;
776 if (m_statement) m_statement->setParent(this);
777}
778
779// --------------------------------------------------------------------------
780DeclarationStatementAST::DeclarationStatementAST()
781 : m_declaration(0)
782{
783}
784
785void DeclarationStatementAST::setDeclaration(DeclarationAST *declaration)
786{
787 m_declaration = declaration;
788 if (m_declaration) m_declaration->setParent(this);
789}
790
791// --------------------------------------------------------------------------
792LabeledStatementAST::LabeledStatementAST()
793 : m_statement(0), m_expression(0)
794{
795}
796
797void LabeledStatementAST::setStatement(StatementAST *statement)
798{
799 m_statement = statement;
800 if (m_statement) m_statement->setParent(this);
801}
802
803void LabeledStatementAST::setExpression(AbstractExpressionAST *expression)
804{
805 m_expression = expression;
806 if (m_expression) m_expression->setParent(this);
807}
808
809// --------------------------------------------------------------------------
810ExpressionStatementAST::ExpressionStatementAST()
811 : m_expression(0)
812{
813}
814
815void ExpressionStatementAST::setExpression(AbstractExpressionAST *expression)
816{
817 m_expression = expression;
818 if (m_expression) m_expression->setParent(this);
819}
820
821
822// --------------------------------------------------------------------------
823ParameterDeclarationAST::ParameterDeclarationAST()
824 : m_typeSpec(0),
825 m_declarator(0),
826 m_expression(0)
827{
828}
829
830void ParameterDeclarationAST::setTypeSpec(TypeSpecifierAST *typeSpec)
831{
832 m_typeSpec = typeSpec;
833 if (m_typeSpec) m_typeSpec->setParent(this);
834}
835
836void ParameterDeclarationAST::setDeclarator(DeclaratorAST *declarator)
837{
838 m_declarator = declarator;
839 if (m_declarator) m_declarator->setParent(this);
840}
841
842void ParameterDeclarationAST::setExpression(AbstractExpressionAST *expression)
843{
844 m_expression = expression;
845 if (m_expression) m_expression->setParent(this);
846}
847
848// --------------------------------------------------------------------------
849ParameterDeclarationListAST::ParameterDeclarationListAST()
850 : m_parameterList(0)
851{
852}
853
854void ParameterDeclarationListAST::addParameter(ParameterDeclarationAST *parameter)
855{
856 if(!parameter)
857 return;
858
859 parameter->setParent(this);
860 m_parameterList = snoc(m_parameterList, parameter, _pool);
861}
862
863// --------------------------------------------------------------------------
864ParameterDeclarationClauseAST::ParameterDeclarationClauseAST()
865 : m_parameterDeclarationList(0),
866 m_ellipsis(0)
867{
868}
869
870void ParameterDeclarationClauseAST::setParameterDeclarationList(ParameterDeclarationListAST *parameterDeclarationList)
871{
872 m_parameterDeclarationList = parameterDeclarationList;
873 if (m_parameterDeclarationList) m_parameterDeclarationList->setParent(this);
874}
875
876void ParameterDeclarationClauseAST::setEllipsis(AST *ellipsis)
877{
878 m_ellipsis = ellipsis;
879 if (m_ellipsis) m_ellipsis->setParent(this);
880}
881
882// --------------------------------------------------------------------------
883AccessDeclarationAST::AccessDeclarationAST()
884 : m_accessList(0)
885{
886}
887
888void AccessDeclarationAST::addAccess(AST *access)
889{
890 if(!access)
891 return;
892
893 access->setParent(this);
894 m_accessList = snoc(m_accessList, access, _pool);
895}
896
897// --------------------------------------------------------------------------
898TypeParameterAST::TypeParameterAST()
899 : m_kind(0), m_templateParameterList(0),
900 m_name(0), m_typeId(0)
901
902{
903}
904
905void TypeParameterAST::setKind(AST *kind)
906{
907 m_kind = kind;
908}
909
910void TypeParameterAST::setTemplateParameterList(TemplateParameterListAST *templateParameterList)
911{
912 m_templateParameterList = templateParameterList;
913 if (m_templateParameterList) m_templateParameterList->setParent(this);
914}
915
916void TypeParameterAST::setName(NameAST *name)
917{
918 m_name = name;
919 if (m_name) m_name->setParent(this);
920}
921
922void TypeParameterAST::setTypeId(AST *typeId)
923{
924 m_typeId = typeId;
925 if (m_typeId) m_typeId->setParent(this);
926}
927
928// --------------------------------------------------------------------------
929TemplateParameterAST::TemplateParameterAST()
930 : m_typeParameter(0),
931 m_typeValueParameter(0)
932{
933}
934
935void TemplateParameterAST::setTypeParameter(TypeParameterAST *typeParameter)
936{
937 m_typeParameter = typeParameter;
938 if (m_typeParameter) m_typeParameter->setParent(this);
939}
940
941void TemplateParameterAST::setTypeValueParameter(ParameterDeclarationAST *typeValueParameter)
942{
943 m_typeValueParameter = typeValueParameter;
944 if (m_typeValueParameter) m_typeValueParameter->setParent(this);
945}
946
947// --------------------------------------------------------------------------
948TemplateParameterListAST::TemplateParameterListAST()
949 : m_templateParameterList(0)
950{
951}
952
953void TemplateParameterListAST::addTemplateParameter(TemplateParameterAST *templateParameter)
954{
955 if(!templateParameter)
956 return;
957
958 templateParameter->setParent(this);
959 m_templateParameterList = snoc(m_templateParameterList, templateParameter, _pool);
960}
961
962// --------------------------------------------------------------------------
963ConditionAST::ConditionAST()
964 : m_typeSpec(0),
965 m_declarator(0),
966 m_expression(0)
967{
968}
969
970void ConditionAST::setTypeSpec(TypeSpecifierAST *typeSpec)
971{
972 m_typeSpec = typeSpec;
973 if (m_typeSpec) m_typeSpec->setParent(this);
974}
975
976void ConditionAST::setDeclarator(DeclaratorAST *declarator)
977{
978 m_declarator = declarator;
979 if (m_declarator) m_declarator->setParent(this);
980}
981
982void ConditionAST::setExpression(AbstractExpressionAST *expression)
983{
984 m_expression = expression;
985 if (m_expression) m_expression->setParent(this);
986}
987
988void ClassSpecifierAST::setWinDeclSpec(AST *winDeclSpec)
989{
990 m_winDeclSpec = winDeclSpec;
991 if (m_winDeclSpec) m_winDeclSpec->setParent(this);
992}
993
994// --------------------------------------------------------------------------
995ReturnStatementAST::ReturnStatementAST()
996 : m_expression(0)
997{
998}
999
1000void ReturnStatementAST::setExpression(AbstractExpressionAST *expression)
1001{
1002 m_expression = expression;
1003 if (m_expression) m_expression->setParent(this);
1004}
1005
1006// --------------------------------------------------------------------------
1007BinaryExpressionAST::BinaryExpressionAST()
1008 : m_op(0), m_left(0), m_right(0)
1009{
1010}
1011
1012void BinaryExpressionAST::setOp(AST *op)
1013{
1014 m_op = op;
1015 if (m_op)
1016 m_op->setParent(this);
1017}
1018
1019void BinaryExpressionAST::setLeftExpression(AbstractExpressionAST *left)
1020{
1021 m_left = left;
1022 if (m_left)
1023 m_left->setParent(this);
1024}
1025
1026void BinaryExpressionAST::setRightExpression(AbstractExpressionAST *right)
1027{
1028 m_right = right;
1029 if (m_right)
1030 m_right->setParent(this);
1031}
1032
1033// --------------------------------------------------------------------------
1034ConditionalExpressionAST::ConditionalExpressionAST()
1035 : m_condition(0), m_left(0), m_right(0)
1036{
1037}
1038
1039void ConditionalExpressionAST::setCondition(AbstractExpressionAST *condition)
1040{
1041 m_condition = condition;
1042 if (m_condition)
1043 m_condition->setParent(this);
1044}
1045
1046void ConditionalExpressionAST::setLeftExpression(AbstractExpressionAST *left)
1047{
1048 m_left = left;
1049 if (m_left)
1050 m_left->setParent(this);
1051}
1052
1053void ConditionalExpressionAST::setRightExpression(AbstractExpressionAST *right)
1054{
1055 m_right = right;
1056 if (m_right)
1057 m_right->setParent(this);
1058}
1059
1060// --------------------------------------------------------------------------
1061CppCastExpressionAST::CppCastExpressionAST()
1062 : m_castOp(0), m_typeId(0), m_expression(0)
1063{
1064}
1065
1066void CppCastExpressionAST::setCastOp(AST *castOp)
1067{
1068 m_castOp = castOp;
1069 if (m_castOp)
1070 m_castOp->setParent(this);
1071}
1072
1073void CppCastExpressionAST::setTypeId(AST *typeId)
1074{
1075 m_typeId = typeId;
1076 if (m_typeId)
1077 m_typeId->setParent(this);
1078}
1079
1080void CppCastExpressionAST::setExpression(AbstractExpressionAST *expression)
1081{
1082 m_expression = expression;
1083 if (m_expression)
1084 m_expression->setParent(this);
1085}
1086
1087// --------------------------------------------------------------------------
1088SubscriptingAST::SubscriptingAST()
1089 : m_expression(0), m_subscript(0)
1090{
1091}
1092
1093void SubscriptingAST::setSubscript(AbstractExpressionAST *subscript)
1094{
1095 m_subscript = subscript;
1096 if (m_subscript)
1097 m_subscript->setParent(this);
1098}
1099
1100void SubscriptingAST::setExpression(AbstractExpressionAST *expression)
1101{
1102 m_expression = expression;
1103 if (m_expression)
1104 m_expression->setParent(this);
1105}
1106
1107// --------------------------------------------------------------------------
1108FunctionCallAST::FunctionCallAST()
1109 : m_expression(0), m_arguments(0)
1110{
1111}
1112
1113void FunctionCallAST::setExpression(AbstractExpressionAST *expression)
1114{
1115 m_expression = expression;
1116 if (m_expression)
1117 m_expression->setParent(this);
1118}
1119
1120void FunctionCallAST::setArguments(AbstractExpressionAST *arguments)
1121{
1122 m_arguments = arguments;
1123 if (m_arguments)
1124 m_arguments->setParent(this);
1125}
1126
1127// --------------------------------------------------------------------------
1128ExplicitTypeConversionAST::ExplicitTypeConversionAST()
1129{
1130}
1131
1132// --------------------------------------------------------------------------
1133PseudoDestructorCallAST::PseudoDestructorCallAST()
1134{
1135}
1136
1137// --------------------------------------------------------------------------
1138ClassMemberAccessAST::ClassMemberAccessAST()
1139 : m_op(0), m_expression(0), m_templ(0), m_name(0)
1140{
1141}
1142
1143void ClassMemberAccessAST::setOp(AST *op)
1144{
1145 m_op = op;
1146 if (m_op)
1147 m_op->setParent(this);
1148}
1149
1150void ClassMemberAccessAST::setExpression(AbstractExpressionAST *expression)
1151{
1152 m_expression = expression;
1153 if (m_expression)
1154 m_expression->setParent(this);
1155}
1156
1157void ClassMemberAccessAST::setName(NameAST *name)
1158{
1159 m_name = name;
1160 if (m_name)
1161 m_name->setParent(this);
1162}
1163
1164// --------------------------------------------------------------------------
1165IncrDecrAST::IncrDecrAST()
1166 : m_op(0), m_expression(0)
1167{
1168}
1169
1170void IncrDecrAST::setOp(AST *op)
1171{
1172 m_op = op;
1173 if (m_op)
1174 m_op->setParent(this);
1175}
1176
1177void IncrDecrAST::setExpression(AbstractExpressionAST *expression)
1178{
1179 m_expression = expression;
1180 if (m_expression)
1181 m_expression->setParent(this);
1182}
1183
1184// --------------------------------------------------------------------------
1185TypeIdentificationAST::TypeIdentificationAST()
1186{
1187}
1188
1189// --------------------------------------------------------------------------
1190TypeIdAST::TypeIdAST()
1191 : m_typeSpecifier(0), m_declarator(0)
1192{
1193}
1194
1195void TypeIdAST::setTypeSpecifier(TypeSpecifierAST *typeSpecifier)
1196{
1197 m_typeSpecifier = typeSpecifier;
1198 if (m_typeSpecifier)
1199 m_typeSpecifier->setParent(this);
1200}
1201
1202void TypeIdAST::setDeclarator(DeclaratorAST *declarator)
1203{
1204 m_declarator = declarator;
1205 if (m_declarator)
1206 m_declarator->setParent(this);
1207}
1208
1209// --------------------------------------------------------------------------
1210AbstractExpressionAST::AbstractExpressionAST()
1211{
1212 m_symbol = 0;
1213}
1214
1215QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.