selfhost/cmd/wcc: drop snake_case from 119 cross-cutting identifiers
This commit is contained in:
@@ -153,7 +153,7 @@ export fn typesinit(c: *tctx, a: *arena) void = {
|
||||
c.ty_untyped_nil = prim(a, TY_UNTYPED_NIL, "untyped_nil", 0u64, 1u64);
|
||||
};
|
||||
|
||||
export fn type_ptr(a: *arena, sub: *tinfo) *tinfo = {
|
||||
export fn typeptr(a: *arena, sub: *tinfo) *tinfo = {
|
||||
let t: *tinfo = newtype(a, TY_PTR);
|
||||
t.sub = sub;
|
||||
t.size = 8u64;
|
||||
@@ -161,7 +161,7 @@ export fn type_ptr(a: *arena, sub: *tinfo) *tinfo = {
|
||||
return t;
|
||||
};
|
||||
|
||||
export fn type_slice(a: *arena, sub: *tinfo) *tinfo = {
|
||||
export fn typeslice(a: *arena, sub: *tinfo) *tinfo = {
|
||||
let t: *tinfo = newtype(a, TY_SLICE);
|
||||
t.sub = sub;
|
||||
t.size = 24u64;
|
||||
@@ -169,7 +169,7 @@ export fn type_slice(a: *arena, sub: *tinfo) *tinfo = {
|
||||
return t;
|
||||
};
|
||||
|
||||
export fn type_array(a: *arena, sub: *tinfo, n: u64) *tinfo = {
|
||||
export fn typearray(a: *arena, sub: *tinfo, n: u64) *tinfo = {
|
||||
let t: *tinfo = newtype(a, TY_ARRAY);
|
||||
t.sub = sub;
|
||||
t.alen = n;
|
||||
@@ -182,7 +182,7 @@ export fn type_array(a: *arena, sub: *tinfo, n: u64) *tinfo = {
|
||||
return t;
|
||||
};
|
||||
|
||||
export fn type_chan(a: *arena, sub: *tinfo) *tinfo = {
|
||||
export fn typechan(a: *arena, sub: *tinfo) *tinfo = {
|
||||
let t: *tinfo = newtype(a, TY_CHAN);
|
||||
t.sub = sub;
|
||||
t.size = 8u64;
|
||||
@@ -190,7 +190,7 @@ export fn type_chan(a: *arena, sub: *tinfo) *tinfo = {
|
||||
return t;
|
||||
};
|
||||
|
||||
export fn type_named(a: *arena, name: str, under: *tinfo) *tinfo = {
|
||||
export fn typenamed(a: *arena, name: str, under: *tinfo) *tinfo = {
|
||||
let t: *tinfo = newtype(a, TY_NAMED);
|
||||
t.name = name;
|
||||
t.under = under;
|
||||
@@ -203,7 +203,7 @@ export fn type_named(a: *arena, name: str, under: *tinfo) *tinfo = {
|
||||
|
||||
// ---- predicates -------------------------------------------------------
|
||||
|
||||
export fn type_isint(t: *tinfo) bool = {
|
||||
export fn typeisint(t: *tinfo) bool = {
|
||||
if (t == nil) { return false; };
|
||||
let k: i32 = t.kind;
|
||||
if (k == TY_I8) { return true; };
|
||||
@@ -220,26 +220,26 @@ export fn type_isint(t: *tinfo) bool = {
|
||||
if (k == TY_RUNE){ return true; };
|
||||
if (k == TY_UNTYPED_INT) { return true; };
|
||||
if (k == TY_UNTYPED_RUNE) { return true; };
|
||||
if (k == TY_NAMED) { return type_isint(t.under); };
|
||||
if (k == TY_NAMED) { return typeisint(t.under); };
|
||||
return false;
|
||||
};
|
||||
|
||||
export fn type_isfloat(t: *tinfo) bool = {
|
||||
export fn typeisfloat(t: *tinfo) bool = {
|
||||
if (t == nil) { return false; };
|
||||
let k: i32 = t.kind;
|
||||
if (k == TY_F32) { return true; };
|
||||
if (k == TY_F64) { return true; };
|
||||
if (k == TY_UNTYPED_FLOAT) { return true; };
|
||||
if (k == TY_NAMED) { return type_isfloat(t.under); };
|
||||
if (k == TY_NAMED) { return typeisfloat(t.under); };
|
||||
return false;
|
||||
};
|
||||
|
||||
export fn type_isnum(t: *tinfo) bool = {
|
||||
if (type_isint(t)) { return true; };
|
||||
return type_isfloat(t);
|
||||
export fn typeisnum(t: *tinfo) bool = {
|
||||
if (typeisint(t)) { return true; };
|
||||
return typeisfloat(t);
|
||||
};
|
||||
|
||||
export fn type_isunsigned(t: *tinfo) bool = {
|
||||
export fn typeisunsigned(t: *tinfo) bool = {
|
||||
if (t == nil) { return false; };
|
||||
let k: i32 = t.kind;
|
||||
if (k == TY_U8) { return true; };
|
||||
@@ -248,11 +248,11 @@ export fn type_isunsigned(t: *tinfo) bool = {
|
||||
if (k == TY_U64) { return true; };
|
||||
if (k == TY_UINT){ return true; };
|
||||
if (k == TY_UINTPTR) { return true; };
|
||||
if (k == TY_NAMED) { return type_isunsigned(t.under); };
|
||||
if (k == TY_NAMED) { return typeisunsigned(t.under); };
|
||||
return false;
|
||||
};
|
||||
|
||||
export fn type_isuntyped(t: *tinfo) bool = {
|
||||
export fn typeisuntyped(t: *tinfo) bool = {
|
||||
if (t == nil) { return false; };
|
||||
let k: i32 = t.kind;
|
||||
if (k == TY_UNTYPED_INT) { return true; };
|
||||
@@ -264,29 +264,29 @@ export fn type_isuntyped(t: *tinfo) bool = {
|
||||
return false;
|
||||
};
|
||||
|
||||
// type_eq — structural equality. Named types compare nominally.
|
||||
export fn type_eq(a: *tinfo, b: *tinfo) bool = {
|
||||
// typeeq — structural equality. Named types compare nominally.
|
||||
export fn typeeq(a: *tinfo, b: *tinfo) bool = {
|
||||
if (a == b) { return true; };
|
||||
if (a == nil) { return false; };
|
||||
if (b == nil) { return false; };
|
||||
if (a.kind != b.kind) { return false; };
|
||||
let k: i32 = a.kind;
|
||||
if (k == TY_PTR) { return type_eq(a.sub, b.sub); };
|
||||
if (k == TY_SLICE) { return type_eq(a.sub, b.sub); };
|
||||
if (k == TY_CHAN) { return type_eq(a.sub, b.sub); };
|
||||
if (k == TY_PTR) { return typeeq(a.sub, b.sub); };
|
||||
if (k == TY_SLICE) { return typeeq(a.sub, b.sub); };
|
||||
if (k == TY_CHAN) { return typeeq(a.sub, b.sub); };
|
||||
if (k == TY_ARRAY) {
|
||||
if (a.alen != b.alen) { return false; };
|
||||
return type_eq(a.sub, b.sub);
|
||||
return typeeq(a.sub, b.sub);
|
||||
};
|
||||
if (k == TY_FN) {
|
||||
if (a.variadic != b.variadic) { return false; };
|
||||
if (!type_eq(a.ret, b.ret)) { return false; };
|
||||
if (!typeeq(a.ret, b.ret)) { return false; };
|
||||
let pa: *tparam = a.params;
|
||||
let pb: *tparam = b.params;
|
||||
for (true) {
|
||||
if (pa == nil) { if (pb == nil) { return true; }; return false; };
|
||||
if (pb == nil) { return false; };
|
||||
if (!type_eq(pa.type_, pb.type_)) { return false; };
|
||||
if (!typeeq(pa.type_, pb.type_)) { return false; };
|
||||
pa = pa.tnext;
|
||||
pb = pb.tnext;
|
||||
};
|
||||
@@ -306,7 +306,7 @@ export fn type_eq(a: *tinfo, b: *tinfo) bool = {
|
||||
if (na[i] != nb[i]) { return false; };
|
||||
i += 1;
|
||||
};
|
||||
if (!type_eq(fa.type_, fb.type_)) { return false; };
|
||||
if (!typeeq(fa.type_, fb.type_)) { return false; };
|
||||
fa = fa.tnext;
|
||||
fb = fb.tnext;
|
||||
};
|
||||
@@ -319,7 +319,7 @@ export fn type_eq(a: *tinfo, b: *tinfo) bool = {
|
||||
for (true) {
|
||||
if (pa == nil) { if (pb == nil) { return true; }; return false; };
|
||||
if (pb == nil) { return false; };
|
||||
if (!type_eq(pa.type_, pb.type_)) { return false; };
|
||||
if (!typeeq(pa.type_, pb.type_)) { return false; };
|
||||
pa = pa.tnext;
|
||||
pb = pb.tnext;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user