public virtual void VisitTypeReferenceCollection(TypeReferenceCollection refs) { foreach (TypeReference type in refs) { VisitTypeReference(type); } }
private void ResolveTypeReferenceCollection(TypeReferenceCollection collection) { foreach (TypeReference tr in collection) { ResolveTypeReference(tr); } }
protected ParameterDeclaration MapParamType(ParameterDeclaration parameter) { if (parameter.Type.NodeType == NodeType.GenericTypeReference) { var gen = (GenericTypeReference)parameter.Type; var genEntityType = gen.Entity as IConstructedTypeInfo; if (genEntityType == null) { return(parameter); } var trc = new TypeReferenceCollection(); foreach (var genArg in gen.GenericArguments) { var replacement = genArg; foreach (var genParam in _genericParams) { if (genParam.Name.Equals(genArg.Entity.Name)) { replacement = new SimpleTypeReference(genParam.Name) { Entity = genParam.Entity }; break; } } trc.Add(replacement); } parameter = parameter.CloneNode(); gen = (GenericTypeReference)parameter.Type; gen.GenericArguments = trc; gen.Entity = new GenericConstructedType(genEntityType.GenericDefinition, trc.Select(a => a.Entity).Cast <IType>().ToArray()); } return(parameter); }
public virtual void OnExcludedTypes(TypeReferenceCollection types) { if (types.Count != 0) { Visit(types.ToNodeArray()); } }
public GenericConstructionChecker(TypeSystemServices tss, Node constructionNode, TypeReferenceCollection argumentNodes, CompilerErrorCollection errorCollection) { _tss = tss; _constructionNode = constructionNode; _argumentNodes = argumentNodes; _errors = errorCollection; }
public override void GatherTypeReferences(ref Types.ITypeReferenceCollection result, Translation.ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } this.ExceptionExpression.GatherTypeReferences(ref result, options); }
/// <summary> /// Performs a look-up on the <see cref="MethodMember"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="MethodMember"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } base.GatherTypeReferences(ref result, options); this.Statements.GatherTypeReferences(ref result, options); }
public override void OnMethodInvocationExpression(MethodInvocationExpression node) { if (node is MethodInvocationExpression && node.Target is GenericReferenceExpression) { var genericReferenceExpression = (GenericReferenceExpression)node.Target; if (genericReferenceExpression.Target is MemberReferenceExpression) { var memberReferenceExpression = (MemberReferenceExpression)genericReferenceExpression.Target; if (memberReferenceExpression.Target is MemberReferenceExpression) { var memberReferenceExpression2 = (MemberReferenceExpression)memberReferenceExpression.Target; if (memberReferenceExpression2.Target is MemberReferenceExpression) { var memberReferenceExpression3 = (MemberReferenceExpression)memberReferenceExpression2.Target; if (memberReferenceExpression3.Target is ReferenceExpression) { var referenceExpression = (ReferenceExpression)memberReferenceExpression3.Target; if (referenceExpression.Name == "Boo" && memberReferenceExpression3.Name == "Lang" && memberReferenceExpression2.Name == "Builtins" && memberReferenceExpression.Name == "array" && 1 == ((ICollection)genericReferenceExpression.GenericArguments).Count) { TypeReference node2 = genericReferenceExpression.GenericArguments[0]; if (1 == ((ICollection)node.Arguments).Count && node.Arguments[0] is CastExpression) { var castExpression = (CastExpression)node.Arguments[0]; Expression target = castExpression.Target; if (castExpression.Type is SimpleTypeReference) { var simpleTypeReference = (SimpleTypeReference)castExpression.Type; if (simpleTypeReference.Name == "int") { var methodInvocationExpression = new MethodInvocationExpression(LexicalInfo.Empty); var arg_255_0 = methodInvocationExpression; var genericReferenceExpression2 = new GenericReferenceExpression(LexicalInfo.Empty); GenericReferenceExpression arg_226_0 = genericReferenceExpression2; var referenceExpression2 = new ReferenceExpression(LexicalInfo.Empty); string text = referenceExpression2.Name = "array"; Expression expression = arg_226_0.Target = referenceExpression2; TypeReferenceCollection typeReferenceCollection = genericReferenceExpression2.GenericArguments = TypeReferenceCollection.FromArray(new TypeReference[] { TypeReference.Lift(node2) }); Expression expression2 = arg_255_0.Target = genericReferenceExpression2; ExpressionCollection expressionCollection = methodInvocationExpression.Arguments = ExpressionCollection.FromArray(new Expression[] { Expression.Lift(target) }); ReplaceCurrentNode(methodInvocationExpression); } } } } } } } } } }
/// <summary> /// Checks whether a given set of arguments can be used to construct a generic type or method from a specified definition. /// </summary> public bool CheckGenericConstruction(IEntity definition, Node node, TypeReferenceCollection arguments, CompilerErrorCollection errors) { GenericConstructionChecker checker = new GenericConstructionChecker( TypeSystemServices, node, arguments, Errors); return(!( checker.NotGenericDefinition(definition) || checker.IncorrectGenerity(definition) || checker.ViolatesParameterConstraints(definition))); }
static void CheckTypeReferenceDuplicates(TypeReferenceCollection references) { List <string> names = new List <string> (); foreach (TypeReference reference in references) { Assert.IsFalse(names.Contains(reference.FullName)); names.Add(reference.FullName); } }
public override void VisitTypeReferenceCollection(TypeReferenceCollection refs) { foreach (TypeReference tr in refs) { if ((tr.Module.Assembly.Name.Name != Context.ExternalAssemblyName) && GetTypeReference(tr, false) == null) { AddTypeReference(tr); } } }
private static ITypeReferenceCollection DelveFurther(ITypeReferenceCollection itc) { ITypeReferenceCollection result = new TypeReferenceCollection(); foreach (ITypeReference itr in itc) { result.AddRange(DelveFurther(itr)); } return(result); }
public override void VisitTypeReferenceCollection(TypeReferenceCollection refs) { foreach (TypeReference tr in refs) { if (GetTypeReference(tr, false) == null) { AddTypeReference(tr); } } }
/// <summary> /// Performs a look-up on the <see cref="TypeReferenceExpression"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="TypeReferenceExpression"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if ((this.typeReference != null)) { result.Add(this.TypeReference); } }
public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (DefaultType != null) { result.Add(this.DefaultType); } }
/// <summary> /// Performs a look-up on the <see cref="DirectionExpression"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="DirectionExpression"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.directedExpression != null) { this.DirectedExpression.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="ExpressionCollection"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="ExpressionCollection"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } foreach (IExpression iexp in this) { iexp.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="Member{TParent, TDom}"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="Member{TParent, TDom}"/> relies on.</param> /// <remarks>The default <see cref="Member{TParent, TDom}"/> carries an implied reference /// requirement in the form of its <see cref="Attributes"/>.</remarks> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.attributes != null) { this.Attributes.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="ParameteredParameterMember{TParameter, TSignatureDom, TParent}"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="ParameteredParameterMember{TParameter, TSignatureDom, TParent}"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } base.GatherTypeReferences(ref result, options); if ((this.parameterType != null)) { result.Add(this.parameterType); } }
public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.cases != null) { foreach (var @case in this.cases) { @case.GatherTypeReferences(ref result, options); } } }
/// <summary> /// Performs a look-up on the <see cref="MethodInvokeExpression"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="MethodInvokeExpression"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.argumentExpressions != null) { this.ArgumentExpressions.GatherTypeReferences(ref result, options); } if (this.reference != null) { this.reference.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="BinaryOperationExpression"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="BinaryOperationExpression"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.leftSide != null) { this.leftSide.GatherTypeReferences(ref result, options); } if (this.rightSide != null) { this.RightSide.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="BlockedStatement{TDom}"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="BlockedStatement{TDom}"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (this.isDisposed) { return; } if (result == null) { result = new TypeReferenceCollection(); } if (this.statements != null) { this.Statements.GatherTypeReferences(ref result, options); } }
public TypeReference GetTypeReference(TypeReferenceCollection members, TypeReference member) { foreach (TypeReference mr in members) { if ((mr.FullName == member.FullName) && ((mr.DeclaringType == null && member.DeclaringType == null) || (mr.DeclaringType != null && member.DeclaringType != null && mr.DeclaringType.FullName == member.DeclaringType.FullName))) { return(mr); } } return(null); }
/// <summary> /// Performs a look-up on the <see cref="CreateNewObjectExpression"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="CreateNewObjectExpression"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.newType != null) { result.Add(this.NewType); } if (this.arguments != null) { this.arguments.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="TypeParameterMember{TDom, TParent}"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="TypeParameterMember{TDom, TParent}"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } base.GatherTypeReferences(ref result, options); if (this.constraints != null) { foreach (ITypeReference itr in this.Constraints) { result.Add(itr); } } }
/// <summary> /// Performs a look-up on the <see cref="BreakStatement"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="BreakStatement"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.condition != null) { this.condition.GatherTypeReferences(ref result, options); } if (this.terminalVariable != null) { this.terminalVariable.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="StatementBlock"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="StatementBlock"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.locals != null) { this.locals.GatherTypeReferences(ref result, options); } foreach (IStatement ist in this) { ist.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="FieldMember"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="FieldMember"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } base.GatherTypeReferences(ref result, options); if (this.fieldType != null) { result.Add(this.FieldType); } if (this.initializationExpression != null) { this.InitializationExpression.GatherTypeReferences(ref result, options); } }
/// <summary> /// Performs a look-up on the <see cref="CreateArrayExpression"/> to determine its /// dependencies. /// </summary> /// <param name="result">A <see cref="ITypeReferenceCollection"/> which /// relates to the <see cref="ITypeReference"/> instance implementations /// that the <see cref="CreateArrayExpression"/> relies on.</param> /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to /// guide the gathering process.</param> public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options) { if (result == null) { result = new TypeReferenceCollection(); } if (this.initializers != null) { this.Initializers.GatherTypeReferences(ref result, options); } if (this.sizeExpression != null) { this.SizeExpression.GatherTypeReferences(ref result, options); } result.Add(this.arrayType); }
public virtual ITypeReferenceCollection TransformTypeReferenceCollection(ITypeReferenceCollection types) { ITypeReference[] array = new ITypeReference[types.Count]; for (int i = 0; i < types.Count; i++) { array[i] = this.TransformTypeReference(types[i]); } ITypeReferenceCollection target = new TypeReferenceCollection(); target.AddRange(array); return target; }
public static bool Compare(this TypeReferenceCollection source, TypeReferenceCollection n, Func<TypeReference, TypeReference, bool> checkitem) { return Compare<TypeReference>(source,n,checkitem); }
public static bool Compare(this TypeReferenceCollection source, TypeReferenceCollection n) { return Compare<TypeReference>(source,n); }
public static bool Compare(this TypeReferenceCollection source, TypeReferenceCollection n, Func<TypeReference, TypeReference, Action<string, string>, bool> checkitem, Action<string, string> errAct) { return Compare<TypeReference>(source,n,checkitem,errAct); }