mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- $foreach "()" replaced by trailing ":" $foreach ($x, $y : $foo) -> $foreach $x, $y : $foo:
- `$for` "()" replaced by trailing ":" `$for (var $x = 0; $x < FOO; $x++)` -> `$for var $x = 0; $x < FOO; $x++:` - `$switch` "()" replaced by trailing ":" `$switch ($Type)` -> `$switch $Type:` - Empty `$switch` requires trailing ":" `$switch` -> `$switch:`
This commit is contained in:
@@ -79,7 +79,7 @@ fn Backtrace* Backtrace.init(&self, Allocator allocator, uptr offset, String fun
|
||||
fn void*[] capture_current(void*[] buffer)
|
||||
{
|
||||
if (!buffer.len) return buffer[:0];
|
||||
$switch
|
||||
$switch:
|
||||
$case env::POSIX:
|
||||
CInt len = posix::backtrace(buffer.ptr, buffer.len);
|
||||
return buffer[:len];
|
||||
|
||||
@@ -12,7 +12,7 @@ import std::io::path, libc, std::os;
|
||||
fn String! get_var(Allocator allocator, String name) => @pool(allocator)
|
||||
{
|
||||
|
||||
$switch
|
||||
$switch:
|
||||
$case env::LIBC && !env::WIN32:
|
||||
ZString val = libc::getenv(name.zstr_tcopy());
|
||||
return val ? val.copy(allocator) : SearchResult.MISSING?;
|
||||
@@ -46,7 +46,7 @@ fn String! tget_var(String name)
|
||||
*>
|
||||
fn bool set_var(String name, String value, bool overwrite = true) => @pool()
|
||||
{
|
||||
$switch
|
||||
$switch:
|
||||
$case env::WIN32:
|
||||
WString wname = name.to_temp_wstring()!!;
|
||||
if (!overwrite)
|
||||
@@ -104,7 +104,7 @@ fn Path! get_config_dir(Allocator allocator) => @pool(allocator)
|
||||
*>
|
||||
fn bool clear_var(String name) => @pool()
|
||||
{
|
||||
$switch
|
||||
$switch:
|
||||
$case env::WIN32:
|
||||
WString wname = name.to_temp_wstring()!!;
|
||||
return win32::setEnvironmentVariableW(wname, null) == 0;
|
||||
|
||||
Reference in New Issue
Block a user