Skip to content

Commit 20856b3

Browse files
committed
Handle builtins in declarations
1 parent 68e8d64 commit 20856b3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/expr.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ prefix('(', function() {
8585
this.type = 'group'
8686
this.children = [expression(0)]
8787
advance(')')
88-
return this
88+
return this
8989
})
9090
prefix('++')
9191
prefix('--')
@@ -142,7 +142,7 @@ function symbol(id, binding_power) {
142142
}
143143
} else {
144144
sym = Object.create(original_symbol)
145-
sym.id = id
145+
sym.id = id
146146
sym.lbp = binding_power
147147
symbol_table[id] = sym
148148
}

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ function parser() {
504504
function parse_decllist() {
505505
// grab ident
506506

507-
if(token.type === 'ident') {
507+
if(token.type === 'ident' || token.type === 'builtin') {
508508
var name = token.data
509509
state.unshift(ident())
510510
state.scope.define(name)
@@ -560,7 +560,7 @@ function parser() {
560560
}
561561

562562
function parse_ident() {
563-
if(token.type !== 'ident') {
563+
if(token.type !== 'ident' && token.type !== 'builtin') {
564564
return unexpected('expected user-defined name, got '+token.data)
565565
}
566566

0 commit comments

Comments
 (0)