script compile/decompile bug

VERIFIED FIXED in 1.5R4

Status

VERIFIED FIXED
17 years ago
15 years ago

People

(Reporter: bugzilla, Assigned: norrisboyd)

Tracking

other
1.5R4
Other
Neutrino

Details

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
the following code :

>	    	Context cx = Context.enter();
>		Scriptable scope = cx.initStandardObjects( null );
>
>	        cx.setGeneratingDebug( true );
>	        cx.setGeneratingSource( true );
>
>		String src = " var x = 5; var y = 10; "; 
>		StringReader sr = new StringReader( src ); 
>		Script script = null;
>		
>		try {
>			script = cx.compileReader( scope, sr, "Test", 1, null );
>		} catch ( Exception e ) {
>		}
>		System.out.println( cx.decompileScript( script, scope, 4 ) );
>		System.exit( 1 );
		
gives :

	function () {
		[native code]
	}

whereas the following :

>	    	Context cx = Context.enter();
>		Scriptable scope = cx.initStandardObjects( null );
>
>	        cx.setGeneratingDebug( true );
>	        cx.setGeneratingSource( true );
>
>		String src = " var x = 5; var y = 10; "; 
>		StringReader sr = new StringReader( src ); 
>		Script script = null;
>		
>		try {
>			script = cx.compileReader( scope, sr, "Test", 1, null );
>			script.exec(cx, scope);
>		} catch ( Exception e ) {
>		}
>		System.out.println( cx.decompileScript( script, scope, 4 ) );
>		System.exit( 1 );


behaves as expected (by printing the decompiled script). 
( there is a added exec() call to "script" )

Comment 1

16 years ago
This is fixed as a byproduct of recent changes in decompilation support, for
test see the following java source.

Comment 2

16 years ago
Created attachment 109963 [details]
Full program for test case

Comment 3

16 years ago
Marking FIXED.

I successfully compiled and ran Igor's test "Y.java".
I got this output:

[//c/WinNT/profiles/pschwartau/Desktop]
$ java -classpath "D:\JS_trunk\mozilla\js\rhino\build\rhino1_5R4pre\js.jar;." Y
function () {
        [native code, arity=0]
}
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED

Comment 4

16 years ago
Marking Verified -
Status: RESOLVED → VERIFIED

Comment 5

16 years ago
*** Bug 61579 has been marked as a duplicate of this bug. ***

Comment 6

16 years ago
Just to double-check with Igor: was my output above correct?

function () {
        [native code, arity=0]
}

Comment 7

16 years ago
OOPS!!! I had my directories mixed up, and was using an old Rhino tree.
The bug is indeed fixed. Now that I've updated the correct tree, we can
compare rhino1_5R3pre vs. rhino1_5R4pre:


[//c/WinNT/profiles/pschwartau/Desktop]
$ java -classpath "D:\JS_TRUNK\mozilla\js\rhino\build\rhino1_5R3pre\js.jar; ." Y
function () {
        [native code]
}


[//c/WinNT/profiles/pschwartau/Desktop]
$ java -classpath "D:\JS_TRUNK\mozilla\js\rhino\build\rhino1_5R4pre\js.jar; ." Y

    var x = 5;
    var y = 10;


And this shows the effect of the bug fix -

Comment 8

15 years ago
Targeting as resolved against 1.5R4
Target Milestone: --- → 1.5R4
You need to log in before you can comment on or make changes to this bug.