parser: enable CamelCase named method names for JS. objects

pull/6100/head
Delyan Angelov 2020-08-10 10:39:09 +03:00
parent 20a65cf9c8
commit bd32f0969f
1 changed files with 7 additions and 5 deletions

View File

@ -140,13 +140,12 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
p.check(.key_fn) p.check(.key_fn)
p.open_scope() p.open_scope()
// C. || JS. // C. || JS.
language := if p.tok.kind == .name && p.tok.lit == 'C' { mut language := table.Language.v
if p.tok.kind == .name && p.tok.lit == 'C' {
is_unsafe = !p.attrs.contains('trusted') is_unsafe = !p.attrs.contains('trusted')
table.Language.c language = table.Language.c
} else if p.tok.kind == .name && p.tok.lit == 'JS' { } else if p.tok.kind == .name && p.tok.lit == 'JS' {
table.Language.js language = table.Language.js
} else {
table.Language.v
} }
if language != .v { if language != .v {
p.next() p.next()
@ -178,6 +177,9 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
} }
receiver_pos = rec_start_pos.extend(p.tok.position()) receiver_pos = rec_start_pos.extend(p.tok.position())
is_amp := p.tok.kind == .amp is_amp := p.tok.kind == .amp
if p.tok.kind == .name && p.tok.lit == 'JS' {
language = table.Language.js
}
// if rec_mut { // if rec_mut {
// p.check(.key_mut) // p.check(.key_mut)
// } // }