private static VarLikeConstructUse /*!*/ CreatePropertyVariables(VarLikeConstructUse chain, VarLikeConstructUse /*!*/ member) { // dereference function array access: var element = DereferenceFunctionArrayAccess(member); // if (chain != null) { IndirectFcnCall ifc = element as IndirectFcnCall; if (ifc != null && ifc.NameExpr as ItemUse != null) { // we know that FcNAme is VLCU and not Expression, because chain is being parsed: ((VarLikeConstructUse)ifc.NameExpr).IsMemberOf = chain; } else { element.IsMemberOf = chain; } } else { element.IsMemberOf = null; } return(member); }
/// <inheritdoc /> public override void VisitIndirectFcnCall(IndirectFcnCall x) { // Variable method call: $object->$method() FindFunctionCall(x); base.VisitIndirectFcnCall(x); }
/// <summary> /// Initializes a new instance of the <see cref="IndirectFunctionCallPoint" /> class. /// </summary> /// <param name="functionCall">Indirect function call expression</param> /// <param name="name">Indirect name of call</param> /// <param name="thisObj">Program point with an object if the indirect subroutine is method</param> /// <param name="arguments">Program points with arguments of function call</param> internal IndirectFunctionCallPoint(IndirectFcnCall functionCall, ValuePoint name, ValuePoint thisObj, ValuePoint[] arguments) : base(thisObj, functionCall.CallSignature, arguments) { FunctionCall = functionCall; Name = name; }
private static VarLikeConstructUse /*!*/ CreatePropertyVariable(Position pos, CompoundVarUse /*!*/ property, FcnParam parameters) { if (parameters != null) { DirectVarUse direct_use; IndirectVarUse indirect_use; VarLikeConstructUse fcnCall; if ((direct_use = property as DirectVarUse) != null) { QualifiedName method_name = new QualifiedName(new Name(direct_use.VarName.Value), Name.EmptyNames); fcnCall = new DirectFcnCall(pos, method_name, null, property.Position, (List <ActualParam>)parameters.Item2, (List <TypeRef>)parameters.Item1); } else if ((indirect_use = property as IndirectVarUse) != null) { fcnCall = new IndirectFcnCall(pos, indirect_use.VarNameEx, (List <ActualParam>)parameters.Item2, (List <TypeRef>)parameters.Item1); } else { fcnCall = new IndirectFcnCall(pos, (ItemUse)property, (List <ActualParam>)parameters.Item2, (List <TypeRef>)parameters.Item1); } // wrap fcnCall into ItemUse fcnCall = CreateFcnArrayDereference(pos, fcnCall, parameters.Item3); return(fcnCall); } else { return(property); } }
/// <inheritdoc /> public override void VisitIndirectFcnCall(IndirectFcnCall x) { // x.NameExpr is VariableUse -- cannot be done. NameExpr is internal. // Is it enough that we have IndirectFunctionCall? // Could there be something different that var use in nameExpr? occurrenceNodes.Enqueue(x); base.VisitIndirectFcnCall(x); }
public override void VisitIndirectFcnCall(IndirectFcnCall x) { var arguments = CreateArguments(x.CallSignature); var name = CreateRValue(x.PublicNameExpr); var thisObj = GetMemberOf(x); Result(new IndirectFunctionCallPoint(x, name, thisObj, arguments)); }
public override void VisitIndirectFcnCall(IndirectFcnCall x) { VisitElement(x.IsMemberOf); VisitElement(x.PublicNameExpr); // Force traversing foreach (var param in x.CallSignature.Parameters) { VisitElement(param); } }
/// <inheritdoc /> public override void VisitIndirectFcnCall(IndirectFcnCall x) { if (x.IsMemberOf != null) { // Variable method call: $object->$method() FindUndefinedMembersUse(x); } else { // Or __invoke method call if variable is a object occurrenceNodes.Enqueue(x); } base.VisitIndirectFcnCall(x); }
public override void VisitIndirectFcnCall(IndirectFcnCall x) { VisitIsMemberOf(x.IsMemberOf); VisitElement(x.NameExpr); VisitCallSignature(x.CallSignature); }
/// <summary> /// Visit name expression and actual parameters. /// </summary> /// <param name="x"></param> virtual public void VisitIndirectFcnCall(IndirectFcnCall x) { VisitElement(x.NameExpr); VisitFunctionCall(x); }
override public void VisitIndirectFcnCall(IndirectFcnCall x) { _serializer.StartSerialize(typeof(IndirectFcnCall).Name, SerializeSpan(x.Span)); base.VisitIndirectFcnCall(x); _serializer.EndSerialize(); }
private static VarLikeConstructUse /*!*/ CreateVariableUse(Position pos, VarLikeConstructUse /*!*/ variable, VarLikeConstructUse /*!*/ property, FcnParam parameters, VarLikeConstructUse chain) { if (parameters != null) { if (property is ItemUse) { property.IsMemberOf = variable; property = new IndirectFcnCall(pos, property, (List <ActualParam>)parameters.Item2, (List <TypeRef>)parameters.Item1); } else { DirectVarUse direct_use; if ((direct_use = property as DirectVarUse) != null) { QualifiedName method_name = new QualifiedName(new Name(direct_use.VarName.Value), Name.EmptyNames); property = new DirectFcnCall(pos, method_name, null, property.Position, (List <ActualParam>)parameters.Item2, (List <TypeRef>)parameters.Item1); } else { IndirectVarUse indirect_use = (IndirectVarUse)property; property = new IndirectFcnCall(pos, indirect_use.VarNameEx, (List <ActualParam>)parameters.Item2, (List <TypeRef>)parameters.Item1); } property.IsMemberOf = variable; } // wrap into ItemUse property = CreateFcnArrayDereference(pos, property, parameters.Item3); } else { property.IsMemberOf = variable; } if (chain != null) { // finds the first variable use in the chain and connects it to the property VarLikeConstructUse first_in_chain = chain; for (;;) { first_in_chain = DereferenceFunctionArrayAccess(first_in_chain); if (first_in_chain.IsMemberOf != null) { first_in_chain = first_in_chain.IsMemberOf; } else { break; } } first_in_chain.IsMemberOf = property; return(chain); } else { return(property); } }
/// <inheritdoc /> public override void VisitIndirectFcnCall(IndirectFcnCall x) { RValueResult(x); }
/// <inheritdoc /> override public void VisitIndirectFcnCall(IndirectFcnCall x) { VisitElement(x.PublicNameExpr); result = new IndirectFcnCall(x.Position, (Expression)result, x.CallSignature.Parameters, x.CallSignature.GenericParams); }