checker: change expr depth limit to 150 (#10745)

pull/10753/head
shadowninja55 2021-07-10 13:24:53 -04:00 committed by GitHub
parent 44e78a6301
commit b222e4efae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -3651,6 +3651,7 @@ pub fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
}
left_sym := c.table.get_type_symbol(left_type_unwrapped)
right_sym := c.table.get_type_symbol(right_type_unwrapped)
if c.pref.translated {
// TODO fix this in C2V instead, for example cast enums to int before using `|` on them.
// TODO replace all c.pref.translated checks with `$if !translated` for performance
@ -4812,7 +4813,8 @@ pub fn (mut c Checker) expr(node ast.Expr) ast.Type {
defer {
c.expr_level--
}
if c.expr_level > 200 {
// c.expr_level set to 150 so that stack overflow does not occur on windows
if c.expr_level > 150 {
c.error('checker: too many expr levels: $c.expr_level ', node.position())
return ast.void_type
}