Skip to content

Icode_LINE is generated sometimes in a different order (Debugger.onLineChange is not called) #2359

@jcompagner

Description

@jcompagner

we are using still rhino 1.8.0 so not sure if it maybe works now differently with 1.9

but if you have this code:

 var array = [{name:"one"}, {name:"two"}, {name:"tree"}];
	for(var n =0; n < array.length; n++)
	{
		var item = array.at(n);
		if (item.name === "one") {
			application.output("one");
		}
	}

and with the debugger you place a breakpoint on the "if (item.name === "one") {" line
that that line is only hit once, when the name is "one"
(if you make that "one" a "onces" then it will never hit)

This is because the Icode_LINE code is after the evaluation for that line number
if i then make the code:

var array = [{name:"one"}, {name:"two"}, {name:"tree"}];
	for(var n =0; n < array.length; n++)
	{
		var item = array.at(n);
		if (  "one" === item.name) {
			application.output("one");
		}
	}

so i reverse the conditions, it works, then that line is hit 3 times not 1 or never
So for some reason the property expression "item.name" if that is the first expression the new line code is done later..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions