Exemplo n.º 1
0
 public Function(Ast.Program program, Ast.Function function,
                 HashSet <Type> typesDefined)
 {
     Program      = program;
     AstFunction  = function;
     TypesDefined = typesDefined;
 }
Exemplo n.º 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();
        }
Exemplo n.º 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;
     }
 }