示例#1
0
    public T GetInvoker(params Type[] types)
    {
        if (types.Length != numParams)
        {
            throw new InvalidOperationException("Invalid generic arguments ({0} instead of {1})".FormatWith(types.Length, numParams));
        }

        return(executor.GetOrAdd(types, (ts) =>
                                 GeneratorVisitor.GetGenerator <T>(expression, ts).Compile()));
    }
示例#2
0
        /// <summary>
        /// Genera el codi font.
        /// </summary>
        /// <param name="unitDecl">Objecte 'UnitDeclaration'.</param>
        /// <returns>El codi generat.</returns>
        ///
        public static string Generate(UnitDeclaration unitDecl)
        {
            if (unitDecl == null)
            {
                throw new ArgumentNullException(nameof(unitDecl));
            }

            var cb      = new CodeBuilder();
            var visitor = new GeneratorVisitor(cb);

            visitor.Visit(unitDecl);

            return(cb.ToString());
        }
示例#3
0
 public string Next()
 {
     return(GeneratorVisitor.Visit(_syntaxTreeRootNode, nodeBuilder));
 }