4 using System.Collections;
5 using System.Collections.Generic;
7 namespace SiliconStudio.Shaders.Ast
14 #region Constructors and Destructors
21 Attributes =
new List<AttributeBase>();
22 Parameters =
new List<Parameter>();
23 Qualifiers = Qualifier.None;
24 ParameterConstraints =
new List<GenericParameterConstraint>();
29 #region Public Properties
38 public List<AttributeBase> Attributes {
get; set; }
54 public List<GenericParameterConstraint> ParameterConstraints {
get; set; }
62 public List<Parameter> Parameters {
get; set; }
86 public bool IsBuiltin {
get; set; }
90 #region Public Methods
100 foreach (var genericParameterConstraint
in ParameterConstraints)
102 if (genericParameterConstraint.Name == parameterType.Name)
104 return genericParameterConstraint.Constraint(typeToCheck);
117 if (methodDeclaration == null)
120 if (Name != methodDeclaration.
Name)
122 if (Parameters.Count != methodDeclaration.
Parameters.Count)
124 for (
int i = 0; i < Parameters.Count; i++)
126 var parameter = Parameters[i];
127 var parameterAgainst = methodDeclaration.Parameters[i];
128 var parameterType = parameter.Type.ResolveType();
129 var parameterAgainstType = parameterAgainst.Type.ResolveType();
130 if (parameterType != parameterAgainstType)
145 if (methodInvocationExpression == null)
151 methodName = target.Member;
157 methodName = vre.Name;
160 if (Name != methodName)
162 if (Parameters.Count != methodInvocationExpression.
Arguments.Count)
164 for (
int i = 0; i < Parameters.Count; i++)
166 var parameter = Parameters[i];
167 var parameterAgainst = methodInvocationExpression.Arguments[i];
168 var parameterType = parameter.Type.ResolveType();
170 if (parameterAgainst.TypeInference.TargetType == null)
173 var parameterAgainstType = parameterAgainst.TypeInference.TargetType.ResolveType();
174 if (parameterType != parameterAgainstType)
186 target.Attributes = Attributes;
188 target.Parameters = Parameters;
189 target.Qualifiers = Qualifiers;
190 target.ReturnType = ReturnType;
196 ChildrenList.Clear();
197 ChildrenList.Add(ReturnType);
198 ChildrenList.Add(Name);
199 foreach (var variableDeclarator
in Parameters)
201 ChildrenList.Add(variableDeclarator);
205 ChildrenList.Add(Qualifiers);
214 return string.Format(
215 "{0}{1} {2}({3}){4}",
216 Qualifiers == Qualifier.None ? string.Empty : Qualifiers +
" ",
219 string.Join(
",", Parameters),
236 internal void UpdateParameters()
238 foreach (var parameter
in Parameters)
240 parameter.DeclaringMethod =
this;
bool IsSameSignature(MethodInvocationExpression methodInvocationExpression)
Test if a method invocation expression has the same signature.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
A tag interface to identify a container for scope declarations.
Identifier Name
Gets or sets the name.
void CopyTo(MethodDeclaration target)
Copies declartion to another instance.
Base interface for all node providing qualifiers.
bool CheckConstraint(GenericParameterType parameterType, TypeBase typeToCheck)
Checks the constraint.
List< Expression > Arguments
Gets or sets the arguments.
bool IsSameSignature(MethodDeclaration methodDeclaration)
Test if a method declaration has the same signature.
A member reference in the form {this}.{Name}
Defines a generic parameter type.
List< Parameter > Parameters
Gets or sets the parameters.
A reference to a variable.
override string ToString()
MethodDeclaration()
Initializes a new instance of the MethodDeclaration class.
Toplevel interface for a declaration.
static readonly Qualifier None
None Enum.