The default bug view has changed. See this FAQ.

Incorrect type inference for array and object literals

RESOLVED FIXED

Status

Rhino
Compiler
RESOLVED FIXED
10 years ago
10 years ago

People

(Reporter: Norris Boyd, Assigned: Norris Boyd)

Tracking

Details

Attachments

(1 attachment)

(Assignee)

Description

10 years ago
Created attachment 275765 [details] [diff] [review]
Proposed patch

The program

function f() {
  var x = {a:1,b:2};
  return x.a;
}
print(f());

will print "undefined" for optimization level 1 instead of 1 due to the optimizer incorrectly assuming the object literal in the tree is an operator with two number type operands that must thus produce a number.
(Assignee)

Comment 1

10 years ago
Fixed:

Checking in src/org/mozilla/javascript/optimizer/Block.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Block.java,v  <--  Block.java
new revision: 1.37.4.1; previous revision: 1.37
done
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.