Beispiel #1
0
 public override void VisitDirectStMtdCall(DirectStMtdCall x)
 {
     VisitElement(x.TargetType);
     ConsumeToken(Tokens.T_DOUBLE_COLON, "::");
     ConsumeToken(Tokens.T_STRING, x.MethodName.Name.Value);
     VisitCallSignature(x.CallSignature);
 }
            public override void VisitDirectStMtdCall(DirectStMtdCall x)
            {
                VisitSpecificElementProlog();

                SerializeToken(nameof(x.MethodName), x.MethodName.ToString(), x.NameSpan);

                base.VisitDirectStMtdCall(x);
            }
Beispiel #3
0
 override public void VisitDirectStMtdCall(DirectStMtdCall x)
 {
     _serializer.StartSerialize(typeof(DirectStMtdCall).Name, SerializeSpan(x.Span),
                                new NodeObj("ClassName", x.TargetType.QualifiedName.ToString()),
                                new NodeObj("MethodName", x.MethodName.Name.Value));
     base.VisitDirectStMtdCall(x);
     _serializer.EndSerialize();
 }
Beispiel #4
0
 public override void VisitDirectStMtdCall(DirectStMtdCall x)
 {
     VisitElement(x.IsMemberOf);
     VisitElement(x.PublicTypeRef);
     // Force traversing
     foreach (var param in x.CallSignature.Parameters)
     {
         VisitElement(param);
     }
 }
Beispiel #5
0
        public override void VisitDirectStMtdCall(DirectStMtdCall x)
        {
            var arguments = CreateArguments(x.CallSignature);

            ValuePoint thisObj = null;

            if (x.ClassName.QualifiedName.Name.Value == "")
            {
                thisObj = CreateRValue(x.PublicTypeRef);
            }

            Result(new StaticMethodCallPoint(x, thisObj, arguments));
        }
Beispiel #6
0
 /// <summary>
 /// Visit function call actual parameters.
 /// </summary>
 /// <param name="x"></param>
 virtual public void VisitDirectStMtdCall(DirectStMtdCall x)
 {
     VisitElement(x.TargetType);
     VisitFunctionCall(x);
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StaticMethodCallPoint" /> class.
 /// </summary>
 /// <param name="staticMethodCall">Static method call expression</param>
 /// <param name="arguments">Program points with arguments of static method call</param>
 /// <param name="objectName">Name of called object</param>
 internal StaticMethodCallPoint(DirectStMtdCall staticMethodCall, ValuePoint objectName, ValuePoint[] arguments)
     : base(objectName, staticMethodCall.CallSignature, arguments)
 {
     StaticMethodCall = staticMethodCall;
 }
Beispiel #8
0
 /// <inheritdoc />
 public override void VisitDirectStMtdCall(DirectStMtdCall x)
 {
     RValueResult(x);
 }
Beispiel #9
0
        /// <inheritdoc />
        public override void VisitDirectStMtdCall(DirectStMtdCall x)
        {
            // TODO: Reflection used because field "typeRef" should be public
            var type    = x.GetType();
            var field   = type.GetField("typeRef", BindingFlags.NonPublic | BindingFlags.Instance);
            var typeRef = field.GetValue(x);

            var directTypeRef = typeRef as DirectTypeRef;

            Debug.Assert(directTypeRef != null);

            TypeDecl typeNode = null;

            if (directTypeRef.ClassName.IsSelfClassName)
            {
                typeNode = currentType;
            }
            else
            {
                QualifiedName?className;
                if (directTypeRef.ClassName.IsParentClassName)
                {
                    if (baseClassName != null)
                    {
                        className = baseClassName.Value.QualifiedName;
                    }
                    else
                    {
                        className = null;
                    }
                }
                else
                {
                    className = directTypeRef.ClassName;
                }

                if (className != null)
                {
                    PhpType phpType;
                    if (types.TryGetValue(className.Value, out phpType))
                    {
                        // It is not possible to determine what type definition has been declared
                        if (!phpType.Declaration.IsConditional)
                        {
                            var node = phpType.Declaration.GetNode();
                            typeNode = node as TypeDecl;
                            Debug.Assert(typeNode != null, "PhpType is always in type declaration node");
                        }
                    }
                }
            }

            if (typeNode != null)
            {
                foreach (var member in typeNode.Members)
                {
                    var declaration = member as MethodDecl;
                    if (declaration != null)
                    {
                        if (declaration.Name.Equals(x.MethodName))
                        {
                            if (directTypeRef.ClassName.IsSelfClassName ||
                                directTypeRef.ClassName.IsParentClassName
                                // If the method of named class is not static, thus it is an error!
                                || declaration.Modifiers == PhpMemberAttributes.Static)
                            {
                                if (IsPassedByRef(declaration.Signature.FormalParams,
                                                  x.CallSignature.Parameters))
                                {
                                    occurrenceNodes.Enqueue(x);
                                }
                            }
                        }
                    }
                }
            }

            base.VisitDirectStMtdCall(x);
        }
Beispiel #10
0
 private static StaticMethodCallExpression ToStaticMethodCallExpression(DirectStMtdCall e)
 {
     // Log.Debug (e.TargetType.QualifiedName.ToJson());
     return(new StaticMethodCallExpression(ToNameOfMethod(e.MethodName), FromTypeRef(e.TargetType), ToCallSignature(e.CallSignature)));
 }
Beispiel #11
0
 /// <inheritdoc />
 override public void VisitDirectStMtdCall(DirectStMtdCall x)
 {
     result = new DirectStMtdCall(x.Position, x.ClassName, x.ClassNamePosition, x.MethodName, x.NamePosition, x.CallSignature.Parameters, x.CallSignature.GenericParams);
 }