bug=356378 r=brendan a1.9b5=beltzner reporting bad getter usage at compile time, not at runtime.

This commit is contained in:
igor@mir2.org 2008-03-24 06:33:32 -07:00
Родитель 021a04012b
Коммит 575f99c25d
1 изменённых файлов: 21 добавлений и 6 удалений

Просмотреть файл

@ -5355,6 +5355,21 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
op = PN_OP(pn);
#if JS_HAS_GETTER_SETTER
if (op == JSOP_GETTER || op == JSOP_SETTER) {
if (pn2->pn_type == TOK_NAME && PN_OP(pn2) != JSOP_SETNAME) {
/*
* x getter = y where x is a local or let variable is not
* supported.
*/
js_ReportCompileErrorNumber(cx,
TS(cg->treeContext.parseContext),
pn2, JSREPORT_ERROR,
JSMSG_BAD_GETTER_OR_SETTER,
(op == JSOP_GETTER)
? js_getter_str
: js_setter_str);
return JS_FALSE;
}
/* We'll emit these prefix bytecodes after emitting the r.h.s. */
} else
#endif
@ -5438,14 +5453,14 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
/* Finally, emit the specialized assignment bytecode. */
switch (pn2->pn_type) {
case TOK_NAME:
if (pn2->pn_slot < 0 || !pn2->pn_const) {
if (pn2->pn_slot >= 0) {
if (pn2->pn_slot >= 0) {
if (!pn2->pn_const)
EMIT_UINT16_IMM_OP(PN_OP(pn2), atomIndex);
} else {
case TOK_DOT:
EMIT_INDEX_OP(PN_OP(pn2), atomIndex);
}
break;
}
// FALL THROUGH
case TOK_DOT:
EMIT_INDEX_OP(PN_OP(pn2), atomIndex);
break;
case TOK_LB:
#if JS_HAS_LVALUE_RETURN