File indexing completed on 2024-05-19 04:41:36

0001 /*
0002     SPDX-FileCopyrightText: 2006 Andreas Pakulat <apaku@gmx.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "ast.h"
0008 
0009 namespace QMake {
0010 
0011 AST::AST(AST* parent, AST::Type type)
0012     : type(type)
0013     , startLine(-1)
0014     , endLine(-1)
0015     , startColumn(-1)
0016     , endColumn(-1)
0017     , start(-1)
0018     , end(-1)
0019     , parent(parent)
0020 {
0021 }
0022 
0023 AST::~AST()
0024 {
0025 }
0026 
0027 ValueAST::ValueAST(AST* parent)
0028     : AST(parent, AST::Value)
0029 {
0030 }
0031 
0032 StatementAST::StatementAST(AST* parent, AST::Type type)
0033     : AST(parent, type)
0034 {
0035 }
0036 
0037 StatementAST::~StatementAST()
0038 {
0039 }
0040 
0041 AssignmentAST::AssignmentAST(AST* parent)
0042     : StatementAST(parent, AST::Assignment)
0043     , identifier(nullptr)
0044     , op(nullptr)
0045 {
0046 }
0047 
0048 AssignmentAST::~AssignmentAST()
0049 {
0050     delete identifier;
0051     identifier = nullptr;
0052     qDeleteAll(values);
0053     values.clear();
0054     delete op;
0055 }
0056 
0057 ScopeBodyAST::ScopeBodyAST(AST* parent, AST::Type type)
0058     : AST(parent, type)
0059 {
0060 }
0061 
0062 ScopeBodyAST::~ScopeBodyAST()
0063 {
0064     qDeleteAll(ifStatements);
0065     ifStatements.clear();
0066     qDeleteAll(elseStatements);
0067     elseStatements.clear();
0068 }
0069 
0070 FunctionCallAST::FunctionCallAST(AST* parent)
0071     : ScopeAST(parent, AST::FunctionCall)
0072     , identifier(nullptr)
0073 {
0074 }
0075 
0076 FunctionCallAST::~FunctionCallAST()
0077 {
0078     delete identifier;
0079     identifier = nullptr;
0080     qDeleteAll(args);
0081     args.clear();
0082 }
0083 
0084 OrAST::OrAST(AST* parent)
0085     : ScopeAST(parent, AST::Or)
0086 {
0087 }
0088 
0089 OrAST::~OrAST()
0090 {
0091     qDeleteAll(scopes);
0092     scopes.clear();
0093 }
0094 
0095 ProjectAST::ProjectAST()
0096     : AST(nullptr, AST::Project)
0097 {
0098 }
0099 
0100 ProjectAST::~ProjectAST()
0101 {
0102     qDeleteAll(statements);
0103     statements.clear();
0104 }
0105 
0106 ScopeAST::ScopeAST(AST* parent, AST::Type type)
0107     : StatementAST(parent, type)
0108     , body(nullptr)
0109 {
0110 }
0111 
0112 ScopeAST::~ScopeAST()
0113 {
0114     delete body;
0115     body = nullptr;
0116 }
0117 
0118 SimpleScopeAST::SimpleScopeAST(AST* parent)
0119     : ScopeAST(parent, AST::SimpleScope)
0120     , identifier(nullptr)
0121 {
0122 }
0123 
0124 SimpleScopeAST::~SimpleScopeAST()
0125 {
0126     delete identifier;
0127     identifier = nullptr;
0128 }
0129 }