Fix "export" squashing variable declarations

Exports that referenced variables assigned in the module would prevent
the referenced variables from being declared, resulting in
ReferenceErrors at run time.

Fixes #4394.
This commit is contained in:
Chris Connelly
2017-01-26 15:24:25 +00:00
parent 635e207f3f
commit b61324058d
5 changed files with 25 additions and 7 deletions

View File

@@ -44,9 +44,9 @@ function object that has a name filled in, or bottoms out.
Look up a variable name in lexical scope, and declare it if it does not
already exist.
find: (name) ->
find: (name, type = 'var') ->
return yes if @check name
@add name, 'var'
@add name, type
no
Reserve a variable name as originating from a function parameter for this
@@ -116,4 +116,3 @@ of this scope.
assignedVariables: ->
"#{v.name} = #{v.type.value}" for v in @variables when v.type.assigned