示例#1
0
 internal ESIR_LoopStatement(
     ESIR_List <ESIR_Expression> condExpr,
     ESIR_List <ESIR_Expression>?iterExpr,
     ESIR_Statement bodyStmt
     )
 {
     condNode = condExpr;
     iterNode = iterExpr;
     bodyNode = bodyStmt;
 }
示例#2
0
 public ESIR_Tree(
     ESIR_List <ESIR_StaticVariable> staticVars,
     ESIR_List <ESIR_Function> functions,
     ESIR_List <ESIR_Struct> structs
     )
 {
     staticVarsNode = staticVars;
     functionsNode  = functions;
     structsNode    = structs;
 }
示例#3
0
    private static ESIR_ExpressionList ExpressionList(ESIR_List <ESIR_Expression> exprs)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.ExpressionList, exprs, out var hash);

        if (node is not null)
        {
            return((ESIR_ExpressionList)node);
        }

        var ret = new ESIR_ExpressionList(exprs);

        if (hash >= 0)
        {
            ESIR_NodeCache.Shared.AddNode(ret, hash);
        }

        return(ret);
    }
示例#4
0
    public static ESIR_NewArrayExpression NewArrayExpression(ESIR_TypeNode elemType, ESIR_List <ESIR_Expression> indices)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.NewArrayExpression, elemType, indices, out var hash);

        if (node is not null)
        {
            return((ESIR_NewArrayExpression)node);
        }

        var ret = new ESIR_NewArrayExpression(elemType, indices);

        if (hash >= 0)
        {
            ESIR_NodeCache.Shared.AddNode(ret, hash);
        }

        return(ret);
    }
示例#5
0
    public static ESIR_BlockStatement BlockStatement(ESIR_List <ESIR_Statement> statements)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.BlockStatement, statements, out var hash);

        if (node is not null)
        {
            return((ESIR_BlockStatement)node);
        }

        var ret = new ESIR_BlockStatement(statements);

        if (hash >= 0)
        {
            ESIR_NodeCache.Shared.AddNode(ret, hash);
        }

        return(ret);
    }
示例#6
0
    public static ESIR_LoopStatement LoopStatement(
        ESIR_List <ESIR_Expression> condExpr,
        ESIR_List <ESIR_Expression>?iterExprs,
        ESIR_Statement bodyStmt
        )
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.LoopStatement, condExpr, iterExprs, bodyStmt, out var hash);

        if (node is not null)
        {
            return((ESIR_LoopStatement)node);
        }

        var ret = new ESIR_LoopStatement(condExpr, iterExprs, bodyStmt);

        if (hash >= 0)
        {
            ESIR_NodeCache.Shared.AddNode(ret, hash);
        }

        return(ret);
    }
示例#7
0
 private static ESIR_Struct Struct(ESIR_ValueNode type, ESIR_List <ESIR_MemberNode> members)
 => new (type, members);
示例#8
0
 public static ESIR_Struct Struct(ES_TypeInfo *type, ESIR_List <ESIR_MemberNode> members)
 => Struct(ValueNode(type), members);
示例#9
0
    public static ESIR_IndexingExpression IndexingExpression(ESIR_Expression indexedExpr, ESIR_List <ESIR_Expression> ranks)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.IndexingExpression, indexedExpr, ranks, out var hash);

        if (node is not null)
        {
            return((ESIR_IndexingExpression)node);
        }

        var ret = new ESIR_IndexingExpression(indexedExpr, ranks);

        if (hash >= 0)
        {
            ESIR_NodeCache.Shared.AddNode(ret, hash);
        }

        return(ret);
    }
示例#10
0
    private static ESIR_FunctionCallExpression FunctionCallExpression(ESIR_ValueNode name, ESIR_List <ESIR_ArgumentValue> arguments)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.FunctionCallExpression, name, arguments, out var hash);

        if (node is not null)
        {
            return((ESIR_FunctionCallExpression)node);
        }

        var ret = new ESIR_FunctionCallExpression(name, arguments);

        if (hash >= 0)
        {
            ESIR_NodeCache.Shared.AddNode(ret, hash);
        }

        return(ret);
    }
示例#11
0
 public static ESIR_FunctionCallExpression FunctionCallExpression(ArrayPointer <byte> name, ESIR_List <ESIR_ArgumentValue> arguments)
 => FunctionCallExpression(ValueNode(name), arguments);
示例#12
0
 internal ESIR_ExpressionList(ESIR_List <ESIR_Expression> exprs) => exprsNode = exprs;
示例#13
0
 internal ESIR_NewArrayExpression(ESIR_TypeNode elemType, ESIR_List <ESIR_Expression> ranks)
 {
     elemTypeNode = elemType;
     ranksNode    = ranks;
 }
示例#14
0
 internal ESIR_IndexingExpression(ESIR_Expression indexed, ESIR_List <ESIR_Expression> indices)
 {
     indexedNode = indexed;
     indicesNode = indices;
 }
示例#15
0
 internal ESIR_BlockStatement(ESIR_List <ESIR_Statement> statement) => statementsNode = statement;