mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-05 10:14:05 +00:00
Procedure literals for default values in structs
This commit is contained in:
@@ -22,6 +22,7 @@ enum ExactValueKind {
|
||||
ExactValue_Complex,
|
||||
ExactValue_Pointer,
|
||||
ExactValue_Compound, // TODO(bill): Is this good enough?
|
||||
ExactValue_Procedure, // TODO(bill): Is this good enough?
|
||||
ExactValue_Type,
|
||||
|
||||
ExactValue_Count,
|
||||
@@ -37,6 +38,7 @@ struct ExactValue {
|
||||
i64 value_pointer;
|
||||
Complex128 value_complex;
|
||||
AstNode * value_compound;
|
||||
AstNode * value_procedure;
|
||||
Type * value_type;
|
||||
};
|
||||
};
|
||||
@@ -109,6 +111,12 @@ ExactValue exact_value_type(Type *type) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ExactValue exact_value_procedure(AstNode *node) {
|
||||
ExactValue result = {ExactValue_Procedure};
|
||||
result.value_procedure = node;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
ExactValue exact_value_integer_from_string(String string) {
|
||||
return exact_value_u128(u128_from_string(string));
|
||||
|
||||
Reference in New Issue
Block a user