js_ReportCompileErrorNumber(cx, ts, NULL, JSREPORT_ERROR, JSMSG_BAD_IMPORT);
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR, JSMSG_BAD_IMPORT);
ImportExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc){    JSParseNode *pn, *pn2, *pn3;    JSTokenType tt;    MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NO_IMPORT_NAME);    pn = NewParseNode(cx, &CURRENT_TOKEN(ts), PN_NAME);    if (!pn)        return NULL;    pn->pn_op = JSOP_NAME;    pn->pn_atom = CURRENT_TOKEN(ts).t_atom;    pn->pn_expr = NULL;    pn->pn_slot = -1;    pn->pn_attrs = 0;    ts->flags |= TSF_REGEXP;    while ((tt = js_GetToken(cx, ts)) == TOK_DOT || tt == TOK_LB) {        ts->flags &= ~TSF_REGEXP;        if (pn->pn_op == JSOP_IMPORTALL)            goto bad_import;        if (tt == TOK_DOT) {            pn2 = NewParseNode(cx, &CURRENT_TOKEN(ts), PN_NAME);            if (!pn2)                return NULL;            if (js_MatchToken(cx, ts, TOK_STAR)) {                pn2->pn_op = JSOP_IMPORTALL;                pn2->pn_atom = NULL;            } else {                MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NAME_AFTER_DOT);                pn2->pn_op = JSOP_GETPROP;                pn2->pn_atom = CURRENT_TOKEN(ts).t_atom;                pn2->pn_slot = -1;                pn2->pn_attrs = 0;            }            pn2->pn_expr = pn;            pn2->pn_pos.begin = pn->pn_pos.begin;            pn2->pn_pos.end = CURRENT_TOKEN(ts).pos.end;        } else {            /* Make a TOK_LB node. */            pn2 = NewParseNode(cx, &CURRENT_TOKEN(ts), PN_BINARY);            if (!pn2)                return NULL;            pn3 = Expr(cx, ts, tc);            if (!pn3)                return NULL;            MUST_MATCH_TOKEN(TOK_RB, JSMSG_BRACKET_IN_INDEX);            pn2->pn_pos.begin = pn->pn_pos.begin;            pn2->pn_pos.end = CURRENT_TOKEN(ts).pos.end;            pn2->pn_op = JSOP_GETELEM;            pn2->pn_left = pn;            pn2->pn_right = pn3;        }        pn = pn2;        ts->flags |= TSF_REGEXP;    }    ts->flags &= ~TSF_REGEXP;    if (tt == TOK_ERROR)        return NULL;    js_UngetToken(ts);    switch (pn->pn_op) {      case JSOP_GETPROP:        pn->pn_op = JSOP_IMPORTPROP;        break;      case JSOP_GETELEM:        pn->pn_op = JSOP_IMPORTELEM;        break;      case JSOP_IMPORTALL:        break;      default:        goto bad_import;    }    return pn;  bad_import:    js_ReportCompileErrorNumber(cx, ts, NULL, JSREPORT_ERROR, JSMSG_BAD_IMPORT);    return NULL;}