parser: fix treating JS fn calls as type casts (#6779)
parent
68cfbd6d66
commit
3c83551dfe
|
@ -30,6 +30,7 @@ fn class(extends string, instanceof int) {
|
||||||
fn main() {
|
fn main() {
|
||||||
println('Hello from V.js!')
|
println('Hello from V.js!')
|
||||||
println(JS.Math.atan2(1, 0))
|
println(JS.Math.atan2(1, 0))
|
||||||
|
println(JS.eval("console.log('Hello!')"))
|
||||||
mut a := 1
|
mut a := 1
|
||||||
a *= 2
|
a *= 2
|
||||||
a += 3
|
a += 3
|
||||||
|
|
|
@ -1062,7 +1062,7 @@ pub fn (mut p Parser) name_expr() ast.Expr {
|
||||||
// if name in table.builtin_type_names {
|
// if name in table.builtin_type_names {
|
||||||
if (!known_var && (name in p.table.type_idxs ||
|
if (!known_var && (name in p.table.type_idxs ||
|
||||||
name_w_mod in p.table.type_idxs) && name !in ['C.stat', 'C.sigaction']) ||
|
name_w_mod in p.table.type_idxs) && name !in ['C.stat', 'C.sigaction']) ||
|
||||||
is_mod_cast || (!(name.len > 1 && name[0] == `C` && name[1] == `.`) && name[0].is_capital()) {
|
is_mod_cast || (language == .v && name[0].is_capital()) {
|
||||||
// MainLetter(x) is *always* a cast, as long as it is not `C.`
|
// MainLetter(x) is *always* a cast, as long as it is not `C.`
|
||||||
// TODO handle C.stat()
|
// TODO handle C.stat()
|
||||||
start_pos := p.tok.position()
|
start_pos := p.tok.position()
|
||||||
|
|
Loading…
Reference in New Issue