Пример #1
0
        public void Visit(NodeInvoke invoke)
        {
            invoke.args.ForEach(arg => arg.Accept(this));
            var invokeArgs = PopCount(invoke.args.Count);

            var name = invoke.TargetName;

            var symTy = walker.Current.Lookup(name)?.Ty as FnTyRef;
            if (symTy == null)
            {
                log.Error(invoke.spName.span, "No function \"{0}\" was found.", name);
                Push(TyVoid.VoidTy);
                return;
            }

            Push(symTy.returnTy);

            if (invokeArgs.Length != symTy.parameterTys.Count)
            {
                ErrNoSuchFunction(invoke.spName, invokeArgs);
                return;
            }

            for (int i = 0, len = invokeArgs.Length; i < len; i++)
            {
                if (symTy.parameterTys[i].Raw != invokeArgs[i])
                {
                    ErrNoSuchFunction(invoke.spName, invokeArgs);
                    break;
                }
            }
        }
Пример #2
0
 public void Visit(NodeInvoke invoke)
 {
     var name = invoke.TargetName;
     invoke.args.ForEach(arg => arg.Accept(this));
     var args = PopCount(invoke.args.Count);
     var result = BuildCall(builder, GetNamedFunction(module, name), args.Select(arg => arg.value), "");
     Push(invoke.Span, (walker.Current.Lookup(invoke.TargetName).Ty as FnTyRef).returnTy, result);
 }
Пример #3
0
 public void Visit(NodeInvoke invoke)
 {
     log.Error(invoke.Span, "Expressions are not valid in this placement. Perhaps you meant to put it in a function?");
 }
Пример #4
0
 public void Visit(NodeInvoke invoke)
 {
     throw new NotImplementedException();
 }
Пример #5
0
 public void Visit(NodeInvoke invoke)
 {
     invoke.args.ForEach(arg => arg.Accept(this));
 }
Пример #6
0
 public void Visit(NodeInvoke invoke)
 {
     Write(invoke.TargetName);
     foreach (var arg in invoke.args)
     {
         Write(" ");
         arg.Accept(this);
     }
 }