mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Void* should never deref and should allow methods to be attached to it.
This commit is contained in:
@@ -362,6 +362,7 @@ macro uint bool.hash(bool b) => (uint)b;
|
||||
macro uint typeid.hash(typeid t) => ((ulong)(uptr)t).hash();
|
||||
macro uint String.hash(String c) => (uint)fnv32a::encode(c);
|
||||
macro uint char[].hash(char[] c) => (uint)fnv32a::encode(c);
|
||||
macro uint void*.hash(void* ptr) => ((ulong)(uptr)ptr).hash();
|
||||
|
||||
module std::core::builtin @if((env::LINUX || env::DARWIN) && env::COMPILER_SAFE_MODE && env::DEBUG_SYMBOLS);
|
||||
import libc;
|
||||
|
||||
@@ -282,10 +282,10 @@ macro void DString.append(&self, value)
|
||||
self.append_char32(value);
|
||||
$default:
|
||||
$switch
|
||||
$case $assignable(value, Char32):
|
||||
self.append_char32(value);
|
||||
$case $assignable(value, String):
|
||||
self.append_chars(value);
|
||||
$case $defined((Char32)value):
|
||||
self.append_char32((Char32)value);
|
||||
$case $defined((String)value):
|
||||
self.append_chars((String)value);
|
||||
$default:
|
||||
$error "Unsupported type for append – use printf instead.";
|
||||
$endswitch
|
||||
|
||||
@@ -136,7 +136,7 @@ macro usz! print_gen(self, x)
|
||||
$case DString:
|
||||
return self.write(x.str_view());
|
||||
$default:
|
||||
$if $assignable(x, String):
|
||||
$if $defined((String)x):
|
||||
return self.write((String)x);
|
||||
$else
|
||||
return printf("%s", x);
|
||||
|
||||
Reference in New Issue
Block a user