예제 #1
0
        public static Ast.Node CreateCorrectInvokationNode(
			Token Source, 
			ParseScope Scope, 
			Declaration Declaration, 
			List<Node> Arguments)
        {
            if (Declaration.OwnerContextID == Scope.EnvironmentContext.ID && Declaration.OwnerContextID != 0)
                return new Ast.JumpCall(Source, Declaration, Arguments);
            else
            {
                var implementation = Declaration.MakeInvokableFunction();
                if (implementation.IsStackInvokable)
                    return new Ast.StackCall(Source, Declaration, Arguments);
                else
                {
                    throw new CompileError("This should be impossible", Source);
                    //Arguments.Insert(0, new Ast.Literal(Source, Declaration.MakeInvokableFunction(), "GENERIC"));
                    //return new Ast.CompatibleCall(Source, Arguments, Declaration.ReturnTypeName);
                }
            }
        }