A compile time constant is being compiled outside of a class. At the same time currentClass has been casted to a class. This means that some random memory has been accessed. For compile time constants check if the current class isNil (e.g. during an eval) and then start to use "nil class class" which should be equivalent to "nil class asMetaclass".
2013-11-30 Holger Hans Peter Freyther <hol...@freyther.de> * gst-parse.c: Check if currentClass is nil before calling _gst_make_method. --- libgst/gst-parse.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libgst/gst-parse.c b/libgst/gst-parse.c index 232e172..bd551d8 100644 --- a/libgst/gst-parse.c +++ b/libgst/gst-parse.c @@ -1948,6 +1948,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) == '#'); @@ -1960,9 +1961,14 @@ parse_compile_time_constant (gst_parser *p) if (!statements || _gst_had_error) return _gst_make_oop_constant (&location, _gst_nil_oop); + /* This can happen when parsing an Eval statement */ + currentClass = _gst_current_parser->currentClass; + if (IS_NIL(_gst_current_parser->currentClass)) + currentClass = OOP_CLASS(_gst_undefined_object_class); + return _gst_make_method (&location, loc(p, 0), NULL, temps, NULL, statements, NULL, - _gst_current_parser->currentClass, + currentClass, _gst_nil_oop, false); } -- 1.8.4.rc3 _______________________________________________ help-smalltalk mailing list help-smalltalk@gnu.org https://lists.gnu.org/mailman/listinfo/help-smalltalk