示例#1
0
 internal ESIR_FunctionDataAttribute(
     ESIR_ValueNode funcData,
     ESIR_ValueNode?parentType
     )
 {
     funcDataNode   = funcData;
     parentTypeNode = parentType;
 }
示例#2
0
    public static ESIR_LiteralExpression LiteralExpression(ESIR_NodeKind kind, ESIR_ValueNode value)
    {
        if (kind < ESIR_NodeKind.LiteralInt || kind > ESIR_NodeKind.LiteralChar)
        {
            throw new ArgumentOutOfRangeException(nameof(kind), "Kind is not an literal expression.");
        }

        return(LiteralExpressionInternal(kind, value));
    }
示例#3
0
    private static ESIR_TypeNode TypeNode (ESIR_ValueNode ptr) {
        var node = ESIR_NodeCache.Shared.TryGetNode (ESIR_NodeKind.TypeNode, ptr, out var hash);
        if (node is not null)
            return (ESIR_TypeNode) node;

        var ret = new ESIR_TypeNode (ptr);
        if (hash >= 0)
            ESIR_NodeCache.Shared.AddNode (ret, hash);

        return ret;
    }
示例#4
0
    private static ESIR_ArgumentDefinition ArgumentDefinition(ESIR_ValueNode argType, ESIR_TypeNode valueType)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.ArgumentDefinition, argType, valueType, out var hash);

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

        var ret = new ESIR_ArgumentDefinition(argType, valueType);

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

        return(ret);
    }
示例#5
0
    private static ESIR_ArgumentValue ArgumentValue(ESIR_ValueNode argType, ESIR_Expression expression)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.ArgumentValue, argType, expression, out var hash);

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

        var ret = new ESIR_ArgumentValue(argType, expression);

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

        return(ret);
    }
示例#6
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);
    }
示例#7
0
    private static ESIR_LocalValueExpression LocalValueExpression(ESIR_ValueNode index)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.LocalValueExpression, index, out var hash);

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

        var ret = new ESIR_LocalValueExpression(index);

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

        return(ret);
    }
示例#8
0
    private static ESIR_StaticVariableExpression StaticVariableExpression(ESIR_ValueNode name)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.StaticVariableExpression, name, out var hash);

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

        var ret = new ESIR_StaticVariableExpression(name);

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

        return(ret);
    }
示例#9
0
    private static ESIR_GotoLabelStatement GotoLabelStatement(ESIR_ValueNode label)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.GotoLabelStatement, label, out var hash);

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

        var ret = new ESIR_GotoLabelStatement(label);

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

        return(ret);
    }
示例#10
0
 private static ESIR_TraceDataAttribute TraceDataAttribute(ESIR_ValueNode ns, ESIR_ValueNode name, ESIR_ValueNode?parentType, ESIR_ValueNode?fileName)
 => new (ns, name, parentType, fileName);
示例#11
0
 private static ESIR_StaticVariable StaticVariable(ESIR_TypeNode type, ESIR_ValueNode id) => new (type, id);
示例#12
0
 private static ESIR_Struct Struct(ESIR_ValueNode type, ESIR_List <ESIR_MemberNode> members)
 => new (type, members);
示例#13
0
    private static ESIR_MemberAccessExpression MemberAccessExpression(ESIR_Expression parent, ESIR_ValueNode name)
    {
        var node = ESIR_NodeCache.Shared.TryGetNode(ESIR_NodeKind.MemberAccessExpression, parent, name, out var hash);

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

        var ret = new ESIR_MemberAccessExpression(parent, name);

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

        return(ret);
    }
示例#14
0
 private static ESIR_Field Field(ESIR_TypeNode type, ESIR_ValueNode offset, ESIR_ValueNode name)
 => new (type, offset, name);