mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Fix issue where a compile time parameter is followed by "...".
- Fix issue with some conversions to untyped list. - Experimental change: add `+++` `&&&` `|||` as replacement for `$concat`, `$and` and `$or`.
This commit is contained in:
@@ -32,7 +32,7 @@ def Indexs = char[256] @private;
|
||||
def ElementType = $typeof(Type{}[0]);
|
||||
|
||||
const bool NO_KEY_FN @private = types::is_same(KeyFn, EmptySlot);
|
||||
const bool KEY_BY_VALUE @private = $or(NO_KEY_FN, $assignable(Type{}[0], $typefrom(KeyFn.params[0])));
|
||||
const bool KEY_BY_VALUE @private = NO_KEY_FN ||| $assignable(Type{}[0], $typefrom(KeyFn.params[0]));
|
||||
const bool LIST_HAS_REF @private = $defined(&Type{}[0]);
|
||||
|
||||
def KeyFnReturnType = $typefrom(KeyFn.returns) @if(!NO_KEY_FN);
|
||||
|
||||
@@ -20,7 +20,7 @@ fn void isort(Type list, usz low, usz high, CmpFn comp, Context context)
|
||||
{
|
||||
var $has_cmp = @is_valid_macro_slot(comp);
|
||||
var $has_context = @is_valid_macro_slot(context);
|
||||
var $cmp_by_value = $and($has_cmp, $assignable(list[0], $typefrom(CmpFn.params[0])));
|
||||
var $cmp_by_value = $has_cmp &&& $assignable(list[0], $typefrom(CmpFn.params[0]));
|
||||
var $has_get_ref = $defined(&list[0]);
|
||||
for (usz i = low; i < high; ++i)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,8 @@ fn void qsort(Type list, isz low, isz high, CmpFn cmp, Context context)
|
||||
{
|
||||
var $has_cmp = @is_valid_macro_slot(cmp);
|
||||
var $has_context = @is_valid_macro_slot(context);
|
||||
var $cmp_by_value = $and($has_cmp, $assignable(list[0], $typefrom(CmpFn.params[0])));
|
||||
var $cmp_by_value = $has_cmp &&& $assignable(list[0], $typefrom(CmpFn.params[0]));
|
||||
|
||||
if (low >= 0 && high >= 0 && low < high)
|
||||
{
|
||||
Stack stack;
|
||||
|
||||
@@ -20,7 +20,7 @@ macro bool @is_sortable(#list)
|
||||
return false;
|
||||
$default:
|
||||
return true;
|
||||
$endswitch;
|
||||
$endswitch
|
||||
}
|
||||
|
||||
macro bool @is_valid_context(#cmp, #context)
|
||||
@@ -34,7 +34,7 @@ macro bool @is_valid_cmp_fn(#cmp, #list, #context)
|
||||
var $no_context = @is_empty_macro_slot(#context);
|
||||
$switch
|
||||
$case @is_empty_macro_slot(#cmp): return true;
|
||||
$case $or($Type.kindof != FUNC, $Type.returns.kindof != SIGNED_INT): return false;
|
||||
$case $Type.kindof != FUNC ||| $Type.returns.kindof != SIGNED_INT: return false;
|
||||
$case $defined(#cmp(#list[0], #list[0], #context)): return true;
|
||||
$case $defined(#cmp(#list[0], #list[0])): return $no_context;
|
||||
$case $defined(#cmp(&#list[0], &#list[0], #context)): return true;
|
||||
|
||||
Reference in New Issue
Block a user