Exemple #1
0
        private static VariableType GetOperandVarType(AstOperand operand)
        {
            if (operand.Type == OperandType.Attribute)
            {
                if (_builtInAttributes.TryGetValue(operand.Value & ~3, out BuiltInAttribute builtInAttr))
                {
                    return(builtInAttr.Type);
                }
            }

            return(OperandInfo.GetVarType(operand));
        }
Exemple #2
0
        public static VariableType GetNodeDestType(IAstNode node)
        {
            if (node is AstOperation operation)
            {
                return(GetDestVarType(operation.Inst));
            }
            else if (node is AstOperand operand)
            {
                if (operand.Type == OperandType.Attribute)
                {
                    if (_builtInAttributes.TryGetValue(operand.Value & ~3, out BuiltInAttribute builtInAttr))
                    {
                        return(builtInAttr.Type);
                    }
                }

                return(OperandInfo.GetVarType(operand));
            }
            else
            {
                throw new ArgumentException($"Invalid node type \"{node?.GetType().Name ?? "null"}\".");
            }
        }