1
2
3
4
5
6 #include <sngcpp/symbols/VariableSymbol.hpp>
7
8 namespace sngcpp { namespace symbols {
9
10 VariableSymbol::VariableSymbol(const Span& span_, const std::u32string& name_) : Symbol(span_, name_), specifiers(Specifier::none), type(nullptr)
11 {
12 }
13
14 void VariableSymbol::AddSpecifiers(Specifier specifiers_)
15 {
16 specifiers = specifiers | specifiers_;
17 }
18
19 std::std::unique_ptr<sngxml::dom::Element>VariableSymbol::CreateElement()
20 {
21 std::unique_ptr<sngxml::dom::Element> variableElement(new sngxml::dom::Element(U"variable"));
22 variableElement->SetAttribute(U"type", type->Id());
23 if (specifiers != Specifier::none)
24 {
25 variableElement->SetAttribute(U"specifiers", SpecifierStr(specifiers));
26 }
27 return variableElement;
28 }
29
30 } }