public override IExpression Rewrite(IThisReference thisReference) { var boundExpression = new BoundExpression(); boundExpression.Instance = thisReference; boundExpression.Definition = iteratorClosure.ThisFieldReference; boundExpression.Type = iteratorClosure.ThisFieldReference.Type; return boundExpression; }
public override void Visit(IThisReference thisReference) { if (Process(thisReference)) { visitor.Visit(thisReference); } base.Visit(thisReference); }
public override IExpression Rewrite(IThisReference thisReference) { var boundExpression = new BoundExpression(); boundExpression.Instance = thisReference; boundExpression.Definition = iteratorClosure.ThisFieldReference; boundExpression.Type = iteratorClosure.ThisFieldReference.Type; return(boundExpression); }
public override void Visit(IThisReference thisRef) { TryAdd(thisRef, "this"); AddInstanceExpr(Type, thisRef); if (!Parent.ContainsKey(thisRef)) { Parent.Add(thisRef, null); } }
public override void TraverseChildren(IThisReference thisReference) { base.TraverseChildren(thisReference); var typeForThis = this.containingType.ResolvedType; if (typeForThis.IsValueType) { ((ThisReference)thisReference).Type = Immutable.ManagedPointerType.GetManagedPointerType(NamedTypeDefinition.SelfInstance(typeForThis, this.host.InternFactory), this.host.InternFactory); } else { ((ThisReference)thisReference).Type = NamedTypeDefinition.SelfInstance(typeForThis, this.host.InternFactory); } }
private HLLocation ProcessThisReferenceExpression(IThisReference pExpression) { return HLParameterLocation.Create(Parameters[0]); }
public override void Visit(IThisReference thisReference) { TranslatedExpressions.Push(new Bpl.IdentifierExpr(thisReference.Token(), this.sink.ThisVariable)); }
public void Visit(IThisReference thisReference) { Contract.Requires(thisReference != null); throw new NotImplementedException(); }
public void Visit(IThisReference thisReference) { this.traverser.Traverse(thisReference); }
/// <summary> /// Traverses the this reference expression. /// </summary> public void Traverse(IThisReference thisReference) { Contract.Requires(thisReference != null); if (this.preorderVisitor != null) this.preorderVisitor.Visit(thisReference); if (this.StopTraversal) return; this.TraverseChildren(thisReference); if (this.StopTraversal) return; if (this.postorderVisitor != null) this.postorderVisitor.Visit(thisReference); }
public override void TraverseChildren(IThisReference thisReference) { MethodEnter(thisReference); base.TraverseChildren(thisReference); MethodExit(); }
public void Visit(IThisReference thisReference) { this.result = this.copier.Copy(thisReference); }
/// <summary> /// Rewrites the given this reference expression. /// </summary> /// <param name="thisReference"></param> public virtual IExpression Rewrite(IThisReference thisReference) { return thisReference; }
public override void Visit(IThisReference thisReference) { allElements.Add(new InvokInfo(Traverser, "IThisReference", thisReference)); }
/// <summary> /// Generates IL for the specified this reference. /// </summary> /// <param name="thisReference">The this reference.</param> public override void TraverseChildren(IThisReference thisReference) { this.generator.Emit(OperationCode.Ldarg_0); this.StackSize++; }
public override void Visit(IThisReference thisRef) { AddTypeReference(Names.Type, thisRef); }
public override void Visit(IThisReference thisReference) { if(Process(thisReference)){visitor.Visit(thisReference);} base.Visit(thisReference); }
private HLLocation ProcessThisReferenceExpression(IThisReference pExpression) { return(HLParameterLocation.Create(Parameters[0])); }
public virtual void onASTElement(IThisReference thisReference) { }
public override void TraverseChildren(IThisReference thisReference) { base.TraverseChildren(thisReference); var typeForThis = this.containingType.ResolvedType; if (typeForThis.IsValueType) ((ThisReference)thisReference).Type = Immutable.ManagedPointerType.GetManagedPointerType(NamedTypeDefinition.SelfInstance(typeForThis, this.host.InternFactory), this.host.InternFactory); else ((ThisReference)thisReference).Type = NamedTypeDefinition.SelfInstance(typeForThis, this.host.InternFactory); }
public void Visit(IThisReference thisReference) { this.result = this.rewriter.Rewrite(thisReference); }
/// <summary> /// Returns a shallow copy of the given this reference expression. /// </summary> /// <param name="thisReference"></param> public ThisReference Copy(IThisReference thisReference) { Contract.Requires(thisReference != null); Contract.Ensures(Contract.Result<ThisReference>() != null); return new ThisReference(thisReference); }
/// <summary> /// Returns a deep copy of the given this reference expression. /// </summary> /// <param name="thisReference"></param> public ThisReference Copy(IThisReference thisReference) { Contract.Requires(thisReference != null); Contract.Ensures(Contract.Result<ThisReference>() != null); var mutableCopy = this.shallowCopier.Copy(thisReference); this.CopyChildren((Expression)mutableCopy); return mutableCopy; }
/// <summary> /// Performs some computation with the given this reference expression. /// </summary> /// <param name="thisReference"></param> public virtual void Visit(IThisReference thisReference) { }
/// <summary> /// If a definition should be captured, capture it. Otherwise noop. /// /// The act of capturing means mapping the definition (or its type's interned id if the definition is a reference to THIS) to /// a new BoundField object that represents a field in the closure class. /// </summary> /// <param name="definition"></param> private void CaptureDefinition(object definition) { IThisReference /*?*/ thisRef = definition as IThisReference; if (thisRef != null) { definition = thisRef.Type.ResolvedType.InternedKey; } if (this.fieldForCapturedLocalOrParameter.ContainsKey(definition)) { return; } IName /*?*/ name = null; ITypeReference /*?*/ type = null; ILocalDefinition /*?*/ local = definition as ILocalDefinition; var containingClass = this.generatedclosureClass; if (local != null) { if (!this.localOrParameter2ClosureClass.TryGetValue(local, out containingClass)) { return; } if (false && containingClass == this.generatedclosureClass) { // A use of a local is captured only if it is found in a *nested* closure, // not the closure where the local is defined. return; } name = local.Name; type = local.Type; } else { IParameterDefinition /*?*/ par = definition as IParameterDefinition; if (par != null) { if (!this.localOrParameter2ClosureClass.TryGetValue(par, out containingClass)) { return; } name = par.Name; type = par.Type; } else { if (definition is uint) { type = thisRef.Type; name = this.nameTable.GetNameFor("__this value"); } else { return; } } } if (name == null) { return; } FieldDefinition field = new FieldDefinition() { ContainingTypeDefinition = containingClass, InternFactory = this.host.InternFactory, Name = name, Type = this.copyTypeToClosure.Visit(type), Visibility = TypeMemberVisibility.Public }; containingClass.Fields.Add(field); BoundField be = new BoundField(field, field.Type); this.fieldForCapturedLocalOrParameter.Add(definition, be); }
/// <summary> /// Traverses the children of the this reference expression. /// </summary> public virtual void TraverseChildren(IThisReference thisReference) { Contract.Requires(thisReference != null); this.TraverseChildren((IExpression)thisReference); }
/// <summary> /// /// </summary> /// <param name="thisReference"></param> public ThisReference(IThisReference thisReference) : base(thisReference) { }
/// <summary> /// Performs some computation with the given this reference expression. /// </summary> /// <param name="thisReference"></param> public virtual void Visit(IThisReference thisReference) { this.Visit((IExpression)thisReference); }
/// <summary> /// /// </summary> /// <param name="host"></param> /// <param name="fromMethod"></param> /// <param name="toMethod"></param> /// <param name="expressions"></param> public BetaReducer(IMetadataHost host, IMethodDefinition fromMethod, IMethodDefinition toMethod, List<IExpression> expressions) : base(host) { this.fromParameters = new List<IParameterDefinition>(fromMethod.Parameters); this.expressions = expressions; for (ushort i = 0; i < fromMethod.ParameterCount; i++) { this.values.Add(this.fromParameters[i], expressions[i]); } this.targetMethod = toMethod; this.targetType = toMethod.ContainingType; this.sourceMethod = fromMethod; this.sourceType = fromMethod.ContainingType; this.ThisReference = new ThisReference() { Type = this.targetType, }; }
public void Visit(IThisReference thisReference) { throw new NotImplementedException(); }
/// <summary> /// Rewrites the given this reference expression. /// </summary> public override IExpression Rewrite(IThisReference thisReference) { if (this.isInsideAnonymousMethod) { IFieldReference thisField; if (this.fieldReferencesForUseInsideAnonymousMethods.TryGetValue(this.method, out thisField)) { return new BoundExpression() { Instance = this.GetClosureObjectInstanceContaining(thisField), Definition = thisField, Type = thisField.Type }; } } return base.Rewrite(thisReference); }
/// <summary> /// Rewrites the given this reference expression. /// </summary> /// <param name="thisReference"></param> /// <returns></returns> public override IExpression Rewrite(IThisReference thisReference) { var t = thisReference.Type; var gt = t as IGenericTypeInstanceReference; if (gt != null) t = gt.GenericType; var k = t.InternedKey; if (k == this.sourceType.InternedKey) { ITypeReference st = this.targetType; return new ThisReference() { Type = NamedTypeDefinition.SelfInstance((INamedTypeDefinition)st.ResolvedType, this.host.InternFactory), }; } return base.Rewrite(thisReference); }
public override void Visit(IThisReference addition) { _formattedValue = "this"; }
/// <summary> /// Visits the specified this reference. /// </summary> /// <param name="thisReference">The this reference.</param> public override void Visit(IThisReference thisReference) { ThisReference mutableThisReference = new ThisReference(thisReference); this.resultExpression = this.myCodeCopier.DeepCopy(mutableThisReference); }
public override void TraverseChildren(IThisReference thisReference) { if (this.currentAnonymousDelegate != null) this.anonymousDelegatesThatCaptureThis[this.currentAnonymousDelegate] = true; }
/// <summary> /// Returns a deep copy of the given this reference expression. /// </summary> /// <param name="thisReference"></param> public ThisReference Copy(IThisReference thisReference) { var mutableCopy = this.shallowCopier.Copy(thisReference); this.CopyChildren((Expression)mutableCopy); return mutableCopy; }
public override void TraverseChildren(IThisReference thisReference) { this.PrintToken(CSharpToken.This); }
/// <summary> /// Returns a shallow copy of the given this reference expression. /// </summary> /// <param name="thisReference"></param> public ThisReference Copy(IThisReference thisReference) { return new ThisReference(thisReference); }
/// <summary> /// Rewrites the given this reference expression. /// </summary> /// <param name="thisReference"></param> public virtual IExpression Rewrite(IThisReference thisReference) { var mutableThisReference = thisReference as ThisReference; if (mutableThisReference == null) return thisReference; this.RewriteChildren(mutableThisReference); return mutableThisReference; }