From bd32f0969f841dd7547bc3b3e98d0c542e02720e Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 10 Aug 2020 10:39:09 +0300 Subject: [PATCH] parser: enable CamelCase named method names for JS. objects --- vlib/v/parser/fn.v | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index b399d7d6cb..93b6685897 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -140,13 +140,12 @@ fn (mut p Parser) fn_decl() ast.FnDecl { p.check(.key_fn) p.open_scope() // 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') - table.Language.c + language = table.Language.c } else if p.tok.kind == .name && p.tok.lit == 'JS' { - table.Language.js - } else { - table.Language.v + language = table.Language.js } if language != .v { p.next() @@ -178,6 +177,9 @@ fn (mut p Parser) fn_decl() ast.FnDecl { } receiver_pos = rec_start_pos.extend(p.tok.position()) is_amp := p.tok.kind == .amp + if p.tok.kind == .name && p.tok.lit == 'JS' { + language = table.Language.js + } // if rec_mut { // p.check(.key_mut) // }