checker: fix C.xx = C.yy aliases

This commit is contained in:
Alexander Medvednikov 2023-10-15 16:18:00 +03:00
parent c947c140ee
commit 4bc9a8f8d8
2 changed files with 9 additions and 11 deletions

View File

@ -9,23 +9,21 @@ __global g_original_codepage = u32(0)
pub type C.BOOL = bool
pub struct C.HINSTANCE {}
pub type C.HINSTANCE = voidptr
pub struct C.HICON {}
pub type C.HICON = voidptr
pub struct C.HCURSOR {}
pub type C.HCURSOR = voidptr
pub struct C.HCURSOR {}
pub type C.HBRUSH = voidptr
pub struct C.HBRUSH {}
pub type C.HWND = voidptr
pub struct C.HWND {}
pub type C.HGLOBAL = voidptr
pub struct C.HGLOBAL {}
pub type C.HANDLE = voidptr
pub struct C.HANDLE {}
pub struct C.LRESULT {}
pub type C.LRESULT = voidptr
// utf8 to stdout needs C.SetConsoleOutputCP(cp_utf8)
fn C.GetConsoleOutputCP() u32

View File

@ -499,7 +499,7 @@ fn (mut c Checker) type_decl(node ast.TypeDecl) {
}
fn (mut c Checker) alias_type_decl(node ast.AliasTypeDecl) {
if c.file.mod.name != 'builtin' && c.file.mod.name != 'time' {
if c.file.mod.name != 'builtin' && !node.name.starts_with('C.') {
c.check_valid_pascal_case(node.name, 'type alias', node.pos)
}
if !c.ensure_type_exists(node.parent_type, node.type_pos) {