Beispiel #1
0
 public Function(Ast.Program program, Ast.Function function,
                 HashSet <Type> typesDefined)
 {
     Program      = program;
     AstFunction  = function;
     TypesDefined = typesDefined;
 }
Beispiel #2
0
        protected void Function(string name, LambdaExpression expr)
        {
            var block = Ast.Blk();

            BeginScope(block);
            var args = FunctionArguments(expr.Parameters).ToArray();

            _function = Ast.Fun(name, expr.ReturnType, args, block);
            FunctionBody(expr.Body);
            EndScope();
        }
Beispiel #3
0
 public static Ast.Function InstantiateAllMacros(Ast.Function function)
 {
     while (true)
     {
         var instantiated = (Ast.Function)function.Transform(node =>
                                                             node is Ast.MacroCall ? InstantiateMacro(node as Ast.MacroCall) : node);
         if (instantiated == function)
         {
             return(function);
         }
         function = instantiated;
     }
 }