Closed Bug 335043 Opened 18 years ago Closed 14 years ago

Function:toSource:sharp variable problem

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: BijuMailList, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

Function:toSource:sharp variable problem

expressions with Arrays or Objects with sharp variables in Function causes problem in toSource.

function x() {
    a = [#1={}];
    a = [#1={}, #1#];
    a = [#1={a:1}, #1#];
    a = [#1={a:1, b:1}, #1#];
    a = [#1=[]];
    a = [#1=[], #1#];
    a = [#1=[1], #1#];
    a = [#1=[1, 1], #1#];
    a = {a:#1={}};
    a = {a:#1={}, b:#1#};
    a = {a:#1={a:1}, b:#1#};
    a = {a:#1={a:1, b:1}, b:#1#};
    a = {a:#1=[]};
    a = {a:#1=[], b:#1#};
    a = {a:#1=[1], b:#1#};
    a = {a:#1=[1, 1], b:#1#};
}

x


gives ==>

function x() {
    a = [#1={]];
    a = [#1={], #1#];
    a = [#1={, a:1], #1#];
    a = [#1={, a:1, b:1], #1#];
    a = [#1=[]];
    a = [#1=[], #1#];
    a = [#1=[, 1], #1#];
    a = [#1=[, 1, 1], #1#];
    a = {a:#1={]};
    a = {a:#1={], b:#1#};
    a = {a:#1={, a:1], b:#1#};
    a = {a:#1={, a:1, b:1], b:#1#};
    a = {a:#1=[]};
    a = {a:#1=[], b:#1#};
    a = {a:#1=[, 1], b:#1#};
    a = {a:#1=[, 1, 1], b:#1#};
}
testcase function_toSource_sharp_var.html

1. click function_toSource_sharp_var.html
2. click Input Case : 0 link
3. test button

4. repeat on others for other bugs
I don't see the mismatched things like "{]", but I am seeing {} where there should be [].  For example,

js> function() { a = #1=[#1#] }
function () {
    a = #1={, #1#};
}

This makes the fuzzer in bug 349611 sad (after I teach it about sharps).
(In reply to comment #2)
> I don't see the mismatched things like "{]", but I am seeing {} where there
> should be [].

so one issue got fixed...

I get following on 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070119 BonEcho/2.0.0.2pre


function x() {
    a = [#1={}];
    a = [#1={}, #1#];
    a = [#1={, a:1}, #1#];
    a = [#1={, a:1, b:1}, #1#];
    a = [#1={}];
    a = [#1={}, #1#];
    a = [#1={, 1}, #1#];
    a = [#1={, 1, 1}, #1#];
    a = {a:#1={}};
    a = {a:#1={}, b:#1#};
    a = {a:#1={, a:1}, b:#1#};
    a = {a:#1={, a:1, b:1}, b:#1#};
    a = {a:#1={}};
    a = {a:#1={}, b:#1#};
    a = {a:#1={, 1}, b:#1#};
    a = {a:#1={, 1, 1}, b:#1#};
}
Blocks: 368267
Depends on: 379523
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.3a5pre) 
Gecko/20100520 Minefield/3.7a5pre 
gives ==>
function x() {
    a = [#1={}];
    a = [#1={}, #1#];
    a = [#1={a: 1}, #1#];
    a = [#1={a: 1, b: 1}, #1#];
    a = [#1=[]];
    a = [#1=[], #1#];
    a = [#1=[1], #1#];
    a = [#1=[1, 1], #1#];
    a = {a: #1={}};
    a = {a: #1={}, b: #1#};
    a = {a: #1={a: 1}, b: #1#};
    a = {a: #1={a: 1, b: 1}, b: #1#};
    a = {a: #1=[]};
    a = {a: #1=[], b: #1#};
    a = {a: #1=[1], b: #1#};
    a = {a: #1=[1, 1], b: #1#};
}
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Same as above in
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.5pre) 
Gecko/20100526 Namoroka/3.6.5pre
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: