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)); }
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"}\"."); } }