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