msvc: fix self compile, by avoiding explicit casting to the same type
parent
b10fcc79ba
commit
15f4594e44
|
@ -752,10 +752,9 @@ pub fn (c mut Checker) array_init(array_init mut ast.ArrayInit) table.Type {
|
|||
mut full_const_name := if it.mod == 'main' { it.name } else { it.mod + '.' +
|
||||
it.name }
|
||||
if obj := c.file.global_scope.find_const(full_const_name) {
|
||||
cf := ast.ConstField(obj)
|
||||
if cint := is_const_integer(cf) {
|
||||
fixed_size = cint.val.int()
|
||||
}
|
||||
if cint := const_int_value( obj ) {
|
||||
fixed_size = cint
|
||||
}
|
||||
} else {
|
||||
c.error('non existant integer const $full_const_name while initializing the size of a static array',
|
||||
array_init.pos)
|
||||
|
@ -772,6 +771,13 @@ pub fn (c mut Checker) array_init(array_init mut ast.ArrayInit) table.Type {
|
|||
return array_init.typ
|
||||
}
|
||||
|
||||
fn const_int_value(cfield ast.ConstField) ?int {
|
||||
if cint := is_const_integer(cfield) {
|
||||
return cint.val.int()
|
||||
}
|
||||
return none
|
||||
}
|
||||
|
||||
fn is_const_integer(cfield ast.ConstField) ?ast.IntegerLiteral {
|
||||
match cfield.expr {
|
||||
ast.IntegerLiteral {
|
||||
|
|
Loading…
Reference in New Issue