4 using System.Collections.Generic;
6 namespace SiliconStudio.Shaders.Ast
13 #region Constructors and Destructors
20 Attributes =
new List<AttributeBase>();
21 Qualifiers = Qualifier.None;
34 InitialValue = initialValue;
35 Attributes =
new List<AttributeBase>();
36 Qualifiers = Qualifier.None;
41 #region Public Properties
45 public List<AttributeBase> Attributes {
get; set; }
85 public List<Variable> SubVariables {
get; set; }
97 return SubVariables != null && SubVariables.Count > 0;
109 foreach (var subVariable
in SubVariables)
111 yield
return subVariable;
126 Qualifiers |= from.Qualifiers;
127 Attributes.AddRange(from.Attributes);
132 #region Public Methods
137 ChildrenList.Clear();
138 ChildrenList.Add(Type);
139 ChildrenList.Add(Name);
140 if (Qualifiers !=
Qualifier.
None) ChildrenList.Add(Qualifiers);
141 if (InitialValue != null) ChildrenList.Add(InitialValue);
142 if (SubVariables != null)
143 ChildrenList.AddRange(SubVariables);
150 return string.Format(
152 Qualifiers.ToString(
false),
155 Qualifiers.ToString(
true),
156 InitialValue != null ?
" = " + InitialValue : string.Empty);
164 return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Type != null ? Type.GetHashCode() : 0);
Variable()
Initializes a new instance of the Variable class.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
void MergeFrom(Variable from)
Merges attributes and qualifiers from another variable.
Base interface for all node providing qualifiers.
IEnumerable< Variable > Instances()
Returns single variable instances.
override string ToString()
Variable(TypeBase type, string name, Expression initialValue=null)
Initializes a new instance of the Variable class.
override int GetHashCode()
Toplevel interface for a declaration.
static readonly Qualifier None
None Enum.