Bug 26904

Summary: Suppress 'undefined' in JSC program display
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Trivial    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Brent Fulgham
Reported 2009-07-01 14:21:17 PDT
If you play with the JSC program, you can perform various calculations and see results: > 1 + 2 3 > "hello" hello The problem is if you attempt to create a variable binding, which does not return a value. In this case, the JSC program reports 'undefined', which is a surprising result and might confuse a user into thinking an error has occurred. For example: > var add2 = function(arg) { return arg + 2; } undefined > add2(15) 17 It seems like it would be better if the transcript looked like the following: > 1 + 2 3 > var add3 = function(arg) { return arg + 3; } > add3(15) 18
Attachments
Oliver Hunt
Comment 1 2009-07-01 14:28:52 PDT
The result printed is the result of the expression. While it may seem odd that "var x = 5" displays undefined that is specified behaviour. Not doing so would create even more confusion as eval("var x=5") will correctly display undefined. There's also a reasonable concern that changing this behaviour would break the mozilla js test suite you hit with run-javascriptcore-tests
Note You need to log in before you can comment on or make changes to this bug.