json: error if the module is not imported
parent
d3812a73d3
commit
54b3c4d2c5
|
@ -1119,9 +1119,6 @@ fn (p mut Parser) statement(add_semi bool) string {
|
||||||
p.log('var decl')
|
p.log('var decl')
|
||||||
p.var_decl()
|
p.var_decl()
|
||||||
}
|
}
|
||||||
else if p.lit == 'jsdecode' {
|
|
||||||
p.js_decode()
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// panic and exit count as returns since they stop the function
|
// panic and exit count as returns since they stop the function
|
||||||
if p.lit == 'panic' || p.lit == 'exit' {
|
if p.lit == 'panic' || p.lit == 'exit' {
|
||||||
|
@ -2319,6 +2316,9 @@ fn (p mut Parser) factor() string {
|
||||||
return p.map_init()
|
return p.map_init()
|
||||||
}
|
}
|
||||||
if p.lit == 'json' && p.peek() == .dot {
|
if p.lit == 'json' && p.peek() == .dot {
|
||||||
|
if !('json' in p.table.imports) {
|
||||||
|
p.error('undefined: `json`, use `import json`')
|
||||||
|
}
|
||||||
return p.js_decode()
|
return p.js_decode()
|
||||||
}
|
}
|
||||||
//if p.fileis('orm_test') {
|
//if p.fileis('orm_test') {
|
||||||
|
|
Loading…
Reference in New Issue