mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Allow $defined take declarations: $defined(int x = y)
Taking the address of a label would cause a crash. #2430
This commit is contained in:
@@ -212,8 +212,9 @@ fn Entry*? HashMap.get_entry(&map, Key key)
|
||||
}
|
||||
|
||||
<*
|
||||
Get the value or update and
|
||||
@require @assignable_to(#expr, Value)
|
||||
Get the value or set it to the value
|
||||
|
||||
@require $defined(Value val = #expr)
|
||||
*>
|
||||
macro Value HashMap.@get_or_set(&map, Key key, Value #expr)
|
||||
{
|
||||
|
||||
@@ -188,8 +188,9 @@ fn LinkedEntry*? LinkedHashMap.get_entry(&map, Key key)
|
||||
}
|
||||
|
||||
<*
|
||||
Get the value or update and
|
||||
@require @assignable_to(#expr, Value)
|
||||
Get the value or set it to the value
|
||||
|
||||
@require $defined(Value val = #expr)
|
||||
*>
|
||||
macro Value LinkedHashMap.@get_or_set(&map, Key key, Value #expr)
|
||||
{
|
||||
|
||||
@@ -15,8 +15,8 @@ fn usz? Pair.to_format(&self, Formatter* f) @dynamic
|
||||
<*
|
||||
@param [&out] a
|
||||
@param [&out] b
|
||||
@require @assignable_to(self.first, $typeof(*a)) : "You cannot assign the first value to a"
|
||||
@require @assignable_to(self.second, $typeof(*b)) : "You cannot assign the second value to b"
|
||||
@require $defined(*a = self.first) : "You cannot assign the first value to a"
|
||||
@require $defined(*b = self.second) : "You cannot assign the second value to b"
|
||||
*>
|
||||
macro void Pair.unpack(&self, a, b)
|
||||
{
|
||||
@@ -49,9 +49,9 @@ fn usz? Triple.to_format(&self, Formatter* f) @dynamic
|
||||
@param [&out] a
|
||||
@param [&out] b
|
||||
@param [&out] c
|
||||
@require @assignable_to(self.first, $typeof(*a)) : "You cannot assign the first value to a"
|
||||
@require @assignable_to(self.second, $typeof(*b)) : "You cannot assign the second value to b"
|
||||
@require @assignable_to(self.third, $typeof(*c)) : "You cannot assign the second value to c"
|
||||
@require $defined(*a = self.first) : "You cannot assign the first value to a"
|
||||
@require $defined(*b = self.second) : "You cannot assign the second value to b"
|
||||
@require $defined(*c = self.third) : "You cannot assign the second value to c"
|
||||
*>
|
||||
macro void Triple.unpack(&self, a, b, c)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user