This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 101454 - Duplicate variable/functions should generate error (squiggles)
Summary: Duplicate variable/functions should generate error (squiggles)
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-17 20:54 UTC by Lark Fitzgerald
Modified: 2014-06-17 21:19 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lark Fitzgerald 2007-04-17 20:54:45 UTC
build 200704170100

Expected duplicate variables and functions to generate error squiggles.

Steps:
1. create web > visual web project
2. create javascript page
3. paste this code in 2x

var c=0
var t
function timedCount() {
    document.getElementById('txt').value=c
    c=c+1
    t=setTimeout("timedCount()",1000)
}

4. Editor shows no errors, navigator shows both variables and functions.
Comment 1 Jan Jancura 2007-04-17 22:04:20 UTC
Having more declarations of the same variable in the same context is legal in
JavaScript.
But you are right, we can add some warning there.
Comment 2 Torbjorn Norbye 2008-04-12 20:17:24 UTC
I don't think we should show an error for this.

But in 6.1, global variables are shown with a different color so when you open this code fragment in 6.1 you see
instantly that your c and t references inside the timedCount function are indeed referencing the global variables.
Comment 3 Petr Pisl 2014-06-17 21:19:35 UTC
I think that this works as expected from NB 7.3.