Skip to content

Commit 239ce04

Browse files
when encountering an ident decl that has previously been defined, reuse the old definition
1 parent c7b76c0 commit 239ce04

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,9 @@ function parser() {
429429

430430
var lookup = state.scope.find(token.data)
431431

432-
if(lookup && lookup.parent.type === 'struct') {
433-
state.unshift(ident())
432+
if(lookup) {
433+
state.fake(Object.create(lookup))
434+
tokens.shift()
434435
return Advance
435436
}
436437
return unexpected('expected user defined type, struct or keyword, got '+token.data)
@@ -749,6 +750,7 @@ function parser() {
749750
state.fake(mknode(IDENT, {data:'', position: token.position, type:'ident'}))
750751
return Advance
751752
}
753+
752754
return advance_ident(true)()
753755
}
754756
, function() { state.scope.enter(); return Advance }

0 commit comments

Comments
 (0)