Closed Bug 345922 Opened 18 years ago Closed 18 years ago

Identifiers are reserved in attribute identifiers

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla1.8.1beta2

People

(Reporter: nanto, Assigned: mrbkap)

References

Details

(Keywords: verified1.8.1, Whiteboard: [patch])

Attachments

(2 files)

From bug 336376 comment 6:
> > This is a proposed change for ECMA-262 Edition 4.  The suggestion comes from
> > Douglas Crockford.  Instead of reserving identifiers unconditionally, the lexer
> > would reserve outside of contexts that must be property names, specifically
> > 
> > * on the right of . and .. operators
> > * before the : in a property initialiser within an object initialiser
> 
>   * on the right of the :: operator where the right operand is an identifier

And should be on the right of @ operators.

For example,
  <label for="idref"/>.@for
should return "idref" instead of throwing syntax error.
Attached patch FixSplinter Review
Assignee: general → mrbkap
Status: NEW → ASSIGNED
Attachment #230704 - Flags: review?(brendan)
Priority: -- → P3
Whiteboard: [patch]
Target Milestone: --- → mozilla1.8.1beta2
Attachment #230704 - Flags: review?(brendan)
Attachment #230704 - Flags: review+
Attachment #230704 - Flags: approval1.8.1?
Blocks: js1.7
Would there be any point in asserting that the bit is unset when you start?
Comment on attachment 230704 [details] [diff] [review]
Fix

a=drivers. Please land this on the MOZILLA_1_8_BRANCH.

We'd also like to know that we haven't the foggiest clue what you're doing here. :)
Attachment #230704 - Flags: approval1.8.1? → approval1.8.1+
(In reply to comment #2)
> Would there be any point in asserting that the bit is unset when you start?

I looked into this, before attaching the patch, even. The bit is only set around calls to js_GetToken (and macros and functions wrapping it) and immediately unset, so it cannot possibly be set when we get here.
(In reply to comment #3)
> We'd also like to know that we haven't the foggiest clue what you're doing
> here. :)

One of the changes for JS1.7 is to allow keywords to be used as identifiers in certain places where keywords cannot possibly be used. For example, consider the fragment 'foo.if = 3'. The 'if' in the sample cannot possibly be an if statement, so we can simply treat it as the identifier "if" instead of the keyword. The original patch for that feature missed this particular case, which covers the E4X attribute selector (@), which this patch fixes.
Fix checked into the trunk and the 1.8 branch.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
Checking in regress-336376-01.js;
/cvsroot/mozilla/js/tests/js1_7/lexical/regress-336376-01.js,v  <--  regress-336376-01.js
new revision: 1.2; previous revision: 1.1
Flags: in-testsuite+
verified fixed 1.8.1, 1.8 windows/mac(ppc|tel)/linux
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: