Closed Bug 581744 Opened 9 years ago Closed 9 years ago

Remove support for/ignore JSFUN_GETTER and JSFUN_SETTER

Categories

(Core :: JavaScript Engine, defect, minor)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla2.0b3

People

(Reporter: Waldo, Assigned: Waldo)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

Attached patch PatchSplinter Review
The bits, when set, seem to have little to no effect except in (non-standardly) munging the function syntax exposed by Function.prototype.toString.  We also pointlessly (?) examine them in JSOP_DEFFUN_*, because as far as I can tell there's no way to ever get such a function in that code.  (I think I killed the one possibility when removing old-school getter/setter syntaxes; our test suite doesn't exercise the code path.)  This simplifies some code and will make it easier for me to reason about function creation as part of bug 536472.
Attachment #460092 - Flags: review?(brendan)
Comment on attachment 460092 [details] [diff] [review]
Patch

># HG changeset patch
># Parent 4e46a1cbc9db1961408f8ee83fa59026946422ad
># User Jeff Walden <jwalden@mit.edu>
>Deprecate JSFUN_GETTER and JSFUN_SETTER; they never did much, and they're very nearly dead code already.  NOT REVIEWED YET
>
>diff --git a/js/src/jsapi.h b/js/src/jsapi.h
>--- a/js/src/jsapi.h
>+++ b/js/src/jsapi.h
>@@ -480,8 +480,8 @@ extern JS_PUBLIC_DATA(jsid) JSID_VOID;
> 
> /* Function flags, set in JSFunctionSpec and passed to JS_NewFunction etc. */
> #define JSFUN_LAMBDA            0x08    /* expressed, not declared, function */
>-#define JSFUN_GETTER            JSPROP_GETTER
>-#define JSFUN_SETTER            JSPROP_SETTER
>+#define JSFUN_GETTER            0       /* obsolete */
>+#define JSFUN_SETTER            0       /* obsolete */

Looks great, but remove these utterly -- best for embeddings to fail fast at compile time. Likewise for

#define JSFUN_GETTER_TEST(f)       ((f) & JSFUN_GETTER)
#define JSFUN_SETTER_TEST(f)       ((f) & JSFUN_SETTER)

and

#define JSFUN_GSFLAGS(f)        ((f) & (JSFUN_GETTER | JSFUN_SETTER))
#define JSFUN_GSFLAG2ATTR(f)       JSFUN_GSFLAGS(f)

r=me with that.

/be
Attachment #460092 - Flags: review?(brendan) → review+
http://hg.mozilla.org/tracemonkey/rev/4ffdb7de7b89
http://hg.mozilla.org/tracemonkey/rev/0e1199f92cdf

The initial changeset message is inaccurate (speaks of deprecation, not removal), but the bug number is accurate, which is what matters most.
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/4ffdb7de7b89
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.