mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Added $kindof compile time function.
- Deprecated `@typekind` macro in favour of `$kindof`. - Deprecated `@typeis` macro in favour of `$typeof(#foo) == int`.
This commit is contained in:
@@ -45,7 +45,7 @@ fn Path? tcwd() => cwd(tmem) @inline;
|
||||
*>
|
||||
macro void? chdir(path)
|
||||
{
|
||||
$if @typeis(path, String):
|
||||
$if $typeof(path) == String:
|
||||
@pool()
|
||||
{
|
||||
return os::native_chdir(temp(path));
|
||||
@@ -59,7 +59,7 @@ fn Path? temp_directory(Allocator allocator) => os::native_temp_directory(alloca
|
||||
|
||||
fn void? delete(Path path) => os::native_remove(path.str_view()) @inline;
|
||||
|
||||
macro bool @is_pathlike(#path) => @typeis(#path, String) || @typeis(#path, Path);
|
||||
macro bool @is_pathlike(#path) @const => $typeof(#path) == String ||| $typeof(#path) == Path;
|
||||
|
||||
macro bool is_separator(char c, PathEnv path_env = DEFAULT_ENV)
|
||||
{
|
||||
@@ -95,7 +95,7 @@ enum MkdirPermissions
|
||||
*>
|
||||
macro bool? mkdir(path, bool recursive = false, MkdirPermissions permissions = NORMAL)
|
||||
{
|
||||
$if @typeis(path, String):
|
||||
$if $typeof(path) == String:
|
||||
@pool() { return _mkdir(temp(path), recursive, permissions); };
|
||||
$else
|
||||
return _mkdir(path, recursive, permissions);
|
||||
@@ -113,7 +113,7 @@ macro bool? mkdir(path, bool recursive = false, MkdirPermissions permissions = N
|
||||
*>
|
||||
macro bool? rmdir(path)
|
||||
{
|
||||
$if @typeis(path, String):
|
||||
$if $typeof(path) == String:
|
||||
@pool() { return _rmdir(temp(path)); };
|
||||
$else
|
||||
return _mkdir(path);
|
||||
|
||||
Reference in New Issue
Block a user