Array lvals in compiled mode
Stefano Corsi <[email protected]> Mon, 5 May 2003 23:34:03 +0000
| Newsgroups | gmane.comp.lang.moto.devel |
|---|---|
| Organization | Moto Project |
| Message-ID | <[email protected]> |
Dave,
your suggestion about saving the current_rval in MotoEnv worked very well=
,=20
expecially regarding the interpreted part. In the compiled part there was=
one=20
more problem to solve. When you evaluate the lval in motoc_array_lval, th=
e=20
codeval is correctly produced, but then it's pushed on the stack and used=
=20
inside motoc_assign to produce this, quite odd, C code line:
((ST_PUSH("SymbolTable::_arrindex",ST_METHOD),stacktrace_rpop(stab_put(wi=
nes,"Ernest=20
& Julio Gallo","both")))=3D"both");
where, to a function call, is assigned a char *. In fact, the right part =
of=20
the assignment could be ignored here, cause everything happens inside the=
=20
function call...=20
So, as a workaround, I clear the current_rval inside of motoc_array_lval =
if=20
there's an overloaded operator and then I check in motoc_assign this way:
if (env->current_rval !=3D NULL) {
=09buf_printf(sb,"(%s=3D%s)",v1->codeval.value,v2->codeval.value);
} else {
buf_printf(sb,"(%s)",v1->codeval.value);
env->current_rval =3D NULL;
}
and it works. All the code is committed on branch moto_opo.
Now all the most important operators are implemented and the code passes =
all=20
tests.=20
I still have to review and clean all the new code and add some error chec=
king=20
(for example for the use of overloaded operators on NULL object: now it=20
throws an uncaught exception).
Stefano