compiler: enhanced wording of obsolete import const error message

pull/2185/head^2
Delyan Angelov 2019-10-01 14:43:26 +03:00 committed by Alexander Medvednikov
parent 2ac80485c0
commit f332e858d1
1 changed files with 7 additions and 3 deletions

View File

@ -469,9 +469,13 @@ fn (p mut Parser) import_statement() {
}
fn (p mut Parser) const_decl() {
if p.tok == .key_import {
p.error('`import const` was removed from the language, ' +
'use `foo(C.CONST_NAME)` instead')
if p.tok == .key_import {
p.error_with_token_index(
'`import const` was removed from the language, ' +
'because predeclaring C constants is not needed anymore. ' +
'You can use them directly with C.CONST_NAME',
p.cur_tok_index()
)
}
p.inside_const = true
p.check(.key_const)