Closed Bug 592152 Opened 14 years ago Closed 14 years ago

Partial fix for const declarations in narcissus

Categories

(Other Applications Graveyard :: Narcissus, defect)

Other Branch
x86
macOS
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: taustin, Assigned: taustin)

References

Details

Attachments

(1 file)

The attached patch will make const declarations work in Narcissus, rather than have const as a pseudonym for var.

Note that declarations like 'const x;' will still not work correctly.  This might be a little more involved to fix, so I'll open a separate bug for that.

  $ ./njs -e 'const x; x=4; print(x);'
  4

In contrast to spidermonkey:
  $ ./js -e 'const x; x=4; print(x);'
  undefined


Also, updating narcissus-failures.txt.
Attachment #470660 - Flags: review?(dherman)
Blocks: 592335
Comment on attachment 470660 [details] [diff] [review]
Fix for supporting const declarations

>                 if (u.readOnly || !hasDirectProperty(t, s)) {
>-                    definitions.defineProperty(t, s, undefined, x.type !== EVAL_CODE, u.readOnly);
>+                    definitions.defineProperty(t, s, undefined, x.type !== EVAL_CODE, false);

Add a comment here that references bug 592335 and explains that this doesn't quite work because of the |const x;| case. But it's fine for now.

r=me with that one change.

Dave
Attachment #470660 - Flags: review?(dherman) → review+
Changelist:  http://hg.mozilla.org/tracemonkey/rev/a80e6f126a1a
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: