mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Shadowing not detected for generic declarations #2876
This commit is contained in:
@@ -20,12 +20,6 @@ macro void insertionsort(list, cmp = ..., context = ...) @builtin @safemacro
|
||||
|
||||
module std::sort <Type, CmpFn, Context> @private;
|
||||
|
||||
alias ElementType = $typeof(((Type){})[0]);
|
||||
const bool IS_SLICE = Type.kindof == SLICE;
|
||||
alias ListType = $typefrom(IS_SLICE ??? Type : Type*);
|
||||
macro ElementType list_get(ListType l, i) => IS_SLICE ??? l[i] : (*l)[i];
|
||||
macro ElementType* list_get_ref(ListType l, i) => IS_SLICE ??? &l[i] : &(*l)[i];
|
||||
|
||||
fn void isort(ListType list, usz low, usz high, CmpFn comp, Context context) @noinline @private
|
||||
{
|
||||
var $has_cmp = $typeof(comp) != TypeNotSet;
|
||||
|
||||
@@ -43,16 +43,6 @@ macro quickselect(list, isz k, cmp = ..., context = ...) @builtin
|
||||
|
||||
module std::sort <Type, CmpFn, Context> @private;
|
||||
|
||||
alias ElementType = $typeof(((Type){})[0]);
|
||||
const bool IS_SLICE = Type.kindof == SLICE;
|
||||
alias ListType = $typefrom(IS_SLICE ??? Type : Type*);
|
||||
macro list_get(ListType l, i) @if(!IS_SLICE) => (*l)[i];
|
||||
macro list_get(ListType l, i) @if(IS_SLICE) => l[i];
|
||||
macro list_get_ref(ListType l, i) @if(!IS_SLICE) => &(*l)[i];
|
||||
macro list_get_ref(ListType l, i) @if(IS_SLICE) => &l[i];
|
||||
macro list_set(ListType l, i, v) @if(!IS_SLICE) => (*l)[i] = v;
|
||||
macro list_set(ListType l, i, v) @if(IS_SLICE) => l[i] = v;
|
||||
|
||||
struct StackElementItem @private
|
||||
{
|
||||
isz low;
|
||||
|
||||
11
lib/std/sort/sort_common_private.c3
Normal file
11
lib/std/sort/sort_common_private.c3
Normal file
@@ -0,0 +1,11 @@
|
||||
module std::sort <Type, CmpFn, Context> @private;
|
||||
|
||||
alias ElementType = $typeof(((Type){})[0]);
|
||||
const bool IS_SLICE = Type.kindof == SLICE;
|
||||
alias ListType = $typefrom(IS_SLICE ??? Type : Type*);
|
||||
macro ElementType list_get(ListType l, i) @if(!IS_SLICE) => (*l)[i];
|
||||
macro ElementType list_get(ListType l, i) @if(IS_SLICE) => l[i];
|
||||
macro ElementType* list_get_ref(ListType l, i) @if(!IS_SLICE) => &(*l)[i];
|
||||
macro ElementType* list_get_ref(ListType l, i) @if(IS_SLICE) => &l[i];
|
||||
macro void list_set(ListType l, i, v) @if(!IS_SLICE) => (*l)[i] = v;
|
||||
macro void list_set(ListType l, i, v) @if(IS_SLICE) => l[i] = v;
|
||||
Reference in New Issue
Block a user