File indexing completed on 2024-05-05 16:41:08
0001 /* 0002 SPDX-FileCopyrightText: 2008 Niko Sams <niko.sams@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "variabledeclaration.h" 0008 0009 #include <language/duchain/ducontext.h> 0010 #include <language/duchain/duchainregister.h> 0011 0012 using namespace KDevelop; 0013 namespace Php 0014 { 0015 REGISTER_DUCHAIN_ITEM(VariableDeclaration); 0016 0017 VariableDeclaration::VariableDeclaration(VariableDeclarationData& data) : KDevelop::Declaration(data) 0018 { 0019 } 0020 0021 VariableDeclaration::VariableDeclaration(VariableDeclarationData& data, const KDevelop::RangeInRevision& range) 0022 : KDevelop::Declaration(data, range) 0023 { 0024 } 0025 0026 VariableDeclaration::VariableDeclaration(const VariableDeclaration& rhs) 0027 : KDevelop::Declaration(*new VariableDeclarationData(*rhs.d_func())) 0028 { 0029 } 0030 0031 VariableDeclaration::VariableDeclaration(const KDevelop::RangeInRevision& range, KDevelop::DUContext* context) 0032 : KDevelop::Declaration(*new VariableDeclarationData, range) 0033 { 0034 d_func_dynamic()->setClassId(this); 0035 if (context) 0036 setContext(context); 0037 } 0038 VariableDeclaration::~VariableDeclaration() 0039 { 0040 } 0041 0042 uint VariableDeclaration::additionalIdentity() const 0043 { 0044 return 2; 0045 } 0046 0047 KDevelop::DeclarationId VariableDeclaration::id(bool forceDirect) const 0048 { 0049 Q_UNUSED(forceDirect); 0050 //always forceDirect, because there can exist multiple declarations with the 0051 //same identifier within one context, and uses wouldn't work correctly else 0052 return KDevelop::Declaration::id(true); 0053 } 0054 0055 bool VariableDeclaration::isSuperglobal() const 0056 { 0057 DUCHAIN_D(VariableDeclaration); 0058 return d->m_isSuperglobal; 0059 } 0060 0061 void VariableDeclaration::setSuperglobal(bool superglobal) 0062 { 0063 DUCHAIN_D_DYNAMIC(VariableDeclaration); 0064 d->m_isSuperglobal = superglobal; 0065 } 0066 0067 bool VariableDeclaration::isVariadic() const 0068 { 0069 DUCHAIN_D(VariableDeclaration); 0070 return d->m_isVariadic; 0071 } 0072 0073 void VariableDeclaration::setVariadic(bool variadic) 0074 { 0075 DUCHAIN_D_DYNAMIC(VariableDeclaration); 0076 d->m_isVariadic = variadic; 0077 } 0078 0079 }