Skip to content

Commit

Permalink
Fix bug 42097
Browse files Browse the repository at this point in the history
  • Loading branch information
norrisboyd committed Jun 14, 2000
1 parent 767d67a commit 5335cff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion org/mozilla/javascript/NodeTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,9 @@ protected void addVariables(Node tree, VariableTable vars) {
Node node;
while ((node = iterator.nextNode()) != null) {
int nodeType = node.getType();
if (inFunction && nodeType == TokenStream.FUNCTION) {
if (inFunction && nodeType == TokenStream.FUNCTION &&
node != tree)
{
// In a function with both "var x" and "function x",
// disregard the var statement, independent of order.
String name = node.getString();
Expand Down
4 changes: 3 additions & 1 deletion src/org/mozilla/javascript/NodeTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,9 @@ protected void addVariables(Node tree, VariableTable vars) {
Node node;
while ((node = iterator.nextNode()) != null) {
int nodeType = node.getType();
if (inFunction && nodeType == TokenStream.FUNCTION) {
if (inFunction && nodeType == TokenStream.FUNCTION &&
node != tree)
{
// In a function with both "var x" and "function x",
// disregard the var statement, independent of order.
String name = node.getString();
Expand Down

0 comments on commit 5335cff

Please sign in to comment.