mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix treating JS fn calls as type casts (#6779)
This commit is contained in:
parent
68cfbd6d66
commit
3c83551dfe
@ -30,6 +30,7 @@ fn class(extends string, instanceof int) {
|
||||
fn main() {
|
||||
println('Hello from V.js!')
|
||||
println(JS.Math.atan2(1, 0))
|
||||
println(JS.eval("console.log('Hello!')"))
|
||||
mut a := 1
|
||||
a *= 2
|
||||
a += 3
|
||||
|
@ -1062,7 +1062,7 @@ pub fn (mut p Parser) name_expr() ast.Expr {
|
||||
// if name in table.builtin_type_names {
|
||||
if (!known_var && (name in p.table.type_idxs ||
|
||||
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.`
|
||||
// TODO handle C.stat()
|
||||
start_pos := p.tok.position()
|
||||
|
Loading…
Reference in New Issue
Block a user