Hi,

Here is a little Pepsi test case to try:

{ import: Objects }
TestClass : Object ()

TestClass test
[
  | captured other |
  { v_captured = v_other; }.
  [| temp | captured := 0. ] whileTrue.
]

On my system (svn 267), it gives the following error:

[EMAIL PROTECTED]:~/sw/idst/function/examples/mono$ idc -k -c -I ../../objects 
missing-decl.st
missing-decl.o.c: In function 'TestClass__test':
missing-decl.o.c:390: error: 'v_captured' undeclared (first use in this 
function)
missing-decl.o.c:390: error: (Each undeclared identifier is reported only once
missing-decl.o.c:390: error: for each function it appears in.)
[EMAIL PROTECTED]:~/sw/idst/function/examples/mono$ 

Here's the generated C code:

static oop TestClass__test(oop v__closure, oop v_stateful_self, oop v_self)
 {
  _enter("test", "TestClass", 
"/fig/home/michael/sw/idst/function/examples/mono/missing-decl.st");
  oop _state1= _send(s_new_5f_, v__vector, 2);
  oop v_other= 0;
  oop _1= 0;
  (void)v_other;
  _line(4);
 {
# define self ((struct t_TestClass *)v_self)
 v_captured = v_other; 
# undef self
 }
  _1= 0;
  /* Scope('temp'->TemporaryVariableNode) */
  /* Scope('other'->TemporaryVariableNode 'self'->ArgumentVariableNode 
'captured'->TemporaryVariableNode 'stateful_self'->ArgumentVariableNode) */
  /* nil */
  /* 2 */
  /* 1 */
  _1= _send(s_function_5f_arity_5f_outer_state_nlr_5f_, v_BlockClosure, 
(oop)b_1, 0, 0, ((oop *)_state1), 0);
  _line(8);
  _1=_send(s_whileTrue, _1);
  _1= v_self;
  _leave();
  return _1;
  _leave();
 }

Would you please modify the code generator to add something like:

# define v_captured (((oop *)_state1)[0])

after the "# define self" line?

Thanks,

-- 
Michael FIG <[EMAIL PROTECTED]> //\
   http://michael.fig.org/    \//
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to