2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2012-03-24 14:06:46 -04:00
|
|
|
* Copyright 2001, 2011 Fidelity Information Services, Inc *
|
2012-02-05 11:35:58 -05:00
|
|
|
* *
|
|
|
|
* This source code contains the intellectual property *
|
|
|
|
* of its copyright holder(s), and is made available *
|
|
|
|
* under a license. If you do not know the terms of *
|
|
|
|
* the license, please stop and do not read further. *
|
|
|
|
* *
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "mdef.h"
|
|
|
|
#include "compiler.h"
|
|
|
|
#include "opcode.h"
|
2012-03-24 14:06:46 -04:00
|
|
|
#include "fullbool.h"
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
int expr(oprtype *a, int m_type)
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
int rval;
|
2012-02-05 11:35:58 -05:00
|
|
|
DCL_THREADGBL_ACCESS;
|
|
|
|
|
|
|
|
SETUP_THREADGBL_ACCESS;
|
|
|
|
if (!(TREF(expr_depth))++)
|
|
|
|
TREF(expr_start) = TREF(expr_start_orig) = NULL;
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == (rval = eval_expr(a))) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
TREF(expr_depth) = 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
coerce(a, (MUMPS_INT == m_type) ? OCT_MINT : OCT_MVAL);
|
2012-02-05 11:35:58 -05:00
|
|
|
ex_tail(a);
|
|
|
|
if (TREF(expr_start) != TREF(expr_start_orig))
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(TREF(shift_side_effects));
|
|
|
|
assert((OC_GVSAVTARG == (TREF(expr_start))->opcode));
|
|
|
|
if ((OC_GVSAVTARG == (TREF(expr_start))->opcode) && (GTM_BOOL == TREF(gtm_fullbool)))
|
|
|
|
{
|
|
|
|
if ((OC_GVRECTARG != (TREF(curtchain))->exorder.bl->opcode)
|
|
|
|
|| ((TREF(curtchain))->exorder.bl->operand[0].oprval.tref != TREF(expr_start)))
|
|
|
|
newtriple(OC_GVRECTARG)->operand[0] = put_tref(TREF(expr_start));
|
|
|
|
}
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
if (!(--(TREF(expr_depth))))
|
|
|
|
TREF(saw_side_effect) = TREF(shift_side_effects) = FALSE;
|
2012-02-05 11:35:58 -05:00
|
|
|
return rval;
|
|
|
|
}
|