Esempio n. 1
0
 internal ESIR_FunctionDataAttribute(
     ESIR_ValueNode funcData,
     ESIR_ValueNode?parentType
     )
 {
     funcDataNode   = funcData;
     parentTypeNode = parentType;
 }
Esempio n. 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));
    }
Esempio n. 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;
    }
Esempio n. 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);
    }
Esempio n. 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);
    }
Esempio n. 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);
    }
Esempio n. 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);
    }
Esempio n. 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);
    }
Esempio n. 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);
    }
Esempio n. 10
0
 private static ESIR_TraceDataAttribute TraceDataAttribute(ESIR_ValueNode ns, ESIR_ValueNode name, ESIR_ValueNode?parentType, ESIR_ValueNode?fileName)
 => new (ns, name, parentType, fileName);
Esempio n. 11
0
 private static ESIR_StaticVariable StaticVariable(ESIR_TypeNode type, ESIR_ValueNode id) => new (type, id);
Esempio n. 12
0
 private static ESIR_Struct Struct(ESIR_ValueNode type, ESIR_List <ESIR_MemberNode> members)
 => new (type, members);
Esempio n. 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);
    }
Esempio n. 14
0
 private static ESIR_Field Field(ESIR_TypeNode type, ESIR_ValueNode offset, ESIR_ValueNode name)
 => new (type, offset, name);