On Sun, Oct 13, 2013 at 03:12:14PM +0200, Paolo Bonzini wrote:
> > the currentClass is nil in this case? So you ask for using
> >  "nil class asMetaclass"
> 
> It should not be nil, it should be UndefinedObject (so you use
> UndefinedObject asMetaclass).

I think there is a difference between DoIt and Eval. During the
begin of the eval the code expects:

   assert (IS_NIL (_gst_current_parser->currentClass));

the DoIt might temporarily set things to the UndefinedObject
and after conditionally calls _gst_reset_compilation_category.


So my current code is this. It is fixing my segfault. When I
set _gst_current_parser->currentClass I would need to reset
it to _gst_nil_oop when executed during the Eval.

comments?


@@ -1947,6 +1949,7 @@ static tree_node
 parse_compile_time_constant (gst_parser *p)
 {
   tree_node temps, statements;
+  OOP currentClass;
   YYLTYPE location = *loc(p,0);
 
   assert (token (p, 0) == '#');
@@ -1959,9 +1962,14 @@ parse_compile_time_constant (gst_parser *p)
   if (!statements || _gst_had_error)
     return _gst_make_oop_constant (&location, _gst_nil_oop);
 
+  currentClass = _gst_current_parser->currentClass;
+  if (IS_NIL(_gst_current_parser->currentClass))
+    currentClass = _gst_undefined_object_class;
+//  _gst_current_parser->currentClass = currentClass;
+
   return _gst_make_method (&location, loc(p, 0),
                            NULL, temps, NULL, statements, NULL,
-                           _gst_current_parser->currentClass,
+                           currentClass,
                            _gst_nil_oop,
                            false);
 }


_______________________________________________
help-smalltalk mailing list
help-smalltalk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to