Bug 819509 - Make some JSFunction setters idempotent. r=njn

--HG--
extra : rebase_source : 71dab04f49a84d1d3108d610e33fa7e06a18a143
This commit is contained in:
Benjamin Peterson 2012-12-12 01:34:46 -05:00
parent b43c7084b8
commit 8cbbec8014

View File

@ -113,18 +113,19 @@ struct JSFunction : public JSObject
/* Returns the strictness of this function, which must be interpreted. */
inline bool inStrictMode() const;
// Can be called multiple times by the parser.
void setArgCount(uint16_t nargs) {
JS_ASSERT(this->nargs == 0);
JS_ASSERT(this->nargs == 0 || this->nargs == nargs);
this->nargs = nargs;
}
// Can be called multiple times by the parser.
void setHasRest() {
JS_ASSERT(!hasRest());
flags |= HAS_REST;
}
// Can be called multiple times by the parser.
void setHasDefaults() {
JS_ASSERT(!hasDefaults());
flags |= HAS_DEFAULTS;
}
@ -147,8 +148,8 @@ struct JSFunction : public JSObject
flags |= HEAVYWEIGHT;
}
// Can be called multiple times by the parser.
void setIsExprClosure() {
JS_ASSERT(!isExprClosure());
flags |= EXPR_CLOSURE;
}