Пример #1
0
 public Function(Ast.Program program, Ast.Function function,
                 HashSet <Type> typesDefined)
 {
     Program      = program;
     AstFunction  = function;
     TypesDefined = typesDefined;
 }
Пример #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();
        }
Пример #3
0
 internal 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;
     }
 }