Warning, file /kdevelop/kdev-ruby/duchain/declarations/variabledeclaration.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of KDevelop
0002  *
0003  * Copyright (C) 2011-2015 Miquel Sabaté Solà <mikisabate@gmail.com>
0004  *
0005  * This program is free software: you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation, either version 3 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #include <duchain/declarations/variabledeclaration.h>
0020 #include <language/duchain/duchainregister.h>
0021 
0022 namespace ruby {
0023 
0024 REGISTER_DUCHAIN_ITEM(VariableDeclaration);
0025 
0026 VariableDeclaration::VariableDeclaration(VariableDeclarationData &data)
0027     : KDevelop::Declaration(data)
0028 {
0029 }
0030 
0031 VariableDeclaration::VariableDeclaration(VariableDeclarationData &data,
0032                                          const KDevelop::RangeInRevision &range)
0033     : KDevelop::Declaration(data, range)
0034 {
0035 }
0036 
0037 VariableDeclaration::VariableDeclaration(const VariableDeclaration &rhs)
0038     : KDevelop::Declaration(*new VariableDeclarationData(*rhs.d_func()))
0039 {
0040 }
0041 
0042 VariableDeclaration::VariableDeclaration(const KDevelop::RangeInRevision &range,
0043                                          KDevelop::DUContext *context)
0044     : KDevelop::Declaration(*new VariableDeclarationData, range)
0045 {
0046     d_func_dynamic()->setClassId(this);
0047     if (context) {
0048         setContext(context);
0049     }
0050 }
0051 
0052 void VariableDeclaration::setVariableKind(const Node *node)
0053 {
0054     if (node) {
0055         d_func_dynamic()->kind = node->flags;
0056     }
0057 }
0058 
0059 void VariableDeclaration::setVariableKind(int kind)
0060 {
0061     d_func_dynamic()->kind = kind;
0062 }
0063 
0064 int VariableDeclaration::variableKind() const
0065 {
0066     return d_func()->kind;
0067 }
0068 
0069 }