public override bool Visit(AstExternalMethodCallExpression node)
 {
     return true;
 }
 public override bool Visit(AstExternalMethodCallExpression node)
 {
     ErrorIfIsNull(node.CallArgs);
     ErrorIfIsNull(node.Name);
     ErrorIfIsNull(node.Target);
     return true;
 }
Beispiel #3
0
 public AstExternalMethodCallStatement(AstExternalMethodCallExpression expr)
 {
     Expr = expr;
 }
Beispiel #4
0
        // #EXTERNAL_METHOD_CALL ID DOT ID #CALL_ARGS
        private void ConstructExternalMethodCall()
        {
            var callArgs = nodes.Pop() as AstArgumentsCallList;
            var name = nodes.Pop() as AstIdExpression;
            var target = nodes.Pop() as AstIdExpression;

            var thisMethodCall = new AstExternalMethodCallExpression(target, name, callArgs);
            PushNode(thisMethodCall);
        }
        public override bool Visit(AstExternalMethodCallExpression node)
        {
            funcCallArgStack.Push(new List<string>());
            var symbolFunc = table.LookupFunction(node.Target.Id + node.Name.Id);

            if (symbolFunc.ArgumentTypes.Count != 0)
            {
                node.CallArgs.Accept(this);
                GetLLVMBuilInFucntion(node.Target.Id, node.Name.Id);
                codeStream.Write(string.Join(",", GetCurrFuncArg().ToArray()));
                if (!m_suppressClosingParen)
                    codeStream.WriteLine(")");
                else
                    m_suppressClosingParen = false;

                return false;
            }
            else
            {
                GetLLVMBuilInFucntion(node.Target.Id, node.Name.Id);
            }
            return false;
        }
        public override bool Visit(AstExternalMethodCallExpression node)
        {
            var funcInfo = table.LookupFunction(node.Target.Id + node.Name.Id);

            var methodExists = funcInfo != null;
            if (!methodExists)
            {
                DispatchError(node.TextPosition, "Object " + node.Target.Id + " does not have method " + node.Name.Id);
                return false;
            }

            var argsCount = funcInfo.ArgumentTypes.Count;
            var realCount = node.CallArgs.Arguments.Count;
            if (argsCount != realCount)
            {
                DispatchError(node.TextPosition, "Expected " + argsCount + " arguments, got " + realCount);
                return false;
            }

            for (var i = 0; i < node.CallArgs.Arguments.Count; ++i)
            {
                var argument = node.CallArgs.Arguments[i];
                var typeMatched = resolver.Resolve(argument.Expr) == funcInfo.ArgumentTypes[i];
                if (!typeMatched)
                {
                    DispatchError(node.TextPosition, "Invalid arguments for method call " + node.Target.Id + "." + node.Name.Id + "(" + funcInfo.TypesToString() + ")");
                    return false;
                }
            }

            return true;
        }
 public abstract bool Visit(AstExternalMethodCallExpression node);