parser: Update Division or Modulo by Zero Message

pull/2159/head
Swastik Baranwal 2019-09-28 22:22:52 +05:30 committed by Alexander Medvednikov
parent d59d921e84
commit 7952d591b9
1 changed files with 1 additions and 1 deletions

View File

@ -2435,7 +2435,7 @@ fn (p mut Parser) term() string {
p.gen(tok.str())// + ' /*op2*/ ') p.gen(tok.str())// + ' /*op2*/ ')
p.fgen(' ' + tok.str() + ' ') p.fgen(' ' + tok.str() + ' ')
if (is_div || is_mod) && p.tok == .number && p.lit == '0' { if (is_div || is_mod) && p.tok == .number && p.lit == '0' {
p.error('division by zero') p.error('division or modulo by zero')
} }
if is_mod && (is_float_type(typ) || !is_number_type(typ)) { if is_mod && (is_float_type(typ) || !is_number_type(typ)) {
p.error('operator .mod requires integer types') p.error('operator .mod requires integer types')