public override bool Visit(AstThisMethodCallExpression node)
 {
     return true;
 }
 public override bool Visit(AstThisMethodCallExpression node)
 {
     ErrorIfIsNull(node.CallArgs);
     ErrorIfIsNull(node.Name);
     return true;
 }
Пример #3
0
 public AstThisMethodCallStatement(AstThisMethodCallExpression expr)
 {
     Expr = expr;
 }
Пример #4
0
        // #FUNC_CALL #EXTERNAL_METHOD_CALL
        /*private void ConstructFuncCall()
        {
        }
        */
        // #THIS_METHOD_CALL ID #CALL_ARGS
        private void ConstructThisMethodCall()
        {
            var callArgs = nodes.Pop() as AstArgumentsCallList;
            var name = nodes.Pop() as AstIdExpression;

            var thisMethodCall = new AstThisMethodCallExpression(name, callArgs);
            PushNode(thisMethodCall);
        }
Пример #5
0
 public override bool Visit(AstThisMethodCallExpression node)
 {
     funcCallArgStack.Push(new List<string>());
     var symbolFunc = table.LookupFunction(node.Name.Id);
     node.CallArgs.Accept(this);
     codeStream.Write(CreateUnnamedVariable() + " = call " + GetLLVMType(symbolFunc.Type) + " @" + symbolFunc.Name + "(");
     codeStream.Write(string.Join(",", GetCurrFuncArg().ToArray()));
     codeStream.WriteLine(")");
     if (IsNot)
     {
         var tmpStr = " = xor "  + GetLLVMType(symbolFunc.Type) + " 1, " + GetCurrUnnamedVariable() + "";
         codeStream.WriteLine(CreateUnnamedVariable() + tmpStr);
     }
     if (IsNegative)
     {
         var tmpStr = " = sup " + GetLLVMType(symbolFunc.Type) + " 0, " + GetCurrUnnamedVariable();
         codeStream.WriteLine(CreateUnnamedVariable() + tmpStr);
     }
     SaveArg(GetLLVMType(symbolFunc.Type) + " " + GetCurrUnnamedVariable());
     return false;
 }
Пример #6
0
        public override bool Visit(AstThisMethodCallExpression node)
        {
            var funcInfo = table.LookupFunction(node.Name.Id);

            var methodExists = funcInfo != null;
            if (!methodExists)
            {
                DispatchError(node.TextPosition, "Method " + node.Name.Id + " not found in current scope.");
                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.Name.Id + "(" + funcInfo.TypesToString() + ")");
                    return false;
                }
            }

            return true;
        }
Пример #7
0
 public abstract bool Visit(AstThisMethodCallExpression node);