inheriting from itself would hang a tuple definition. only breaks if tuple is being redefined
parent
d893f3cdb7
commit
d46d063f5f
|
@ -142,3 +142,8 @@ TUPLE: parsing-corner-case x ;
|
|||
" x 3 }"
|
||||
} "\n" join eval( -- tuple )
|
||||
] [ error>> unexpected-eof? ] must-fail-with
|
||||
|
||||
TUPLE: bad-inheritance-tuple ;
|
||||
[
|
||||
"IN: classes.tuple.parser.tests TUPLE: bad-inheritance-tuple < bad-inheritance-tuple ;" eval( -- )
|
||||
] [ error>> bad-inheritance? ] must-fail-with
|
||||
|
|
|
@ -56,11 +56,18 @@ ERROR: invalid-slot-name name ;
|
|||
: parse-tuple-slots ( -- )
|
||||
";" parse-tuple-slots-delim ;
|
||||
|
||||
ERROR: bad-inheritance class superclass ;
|
||||
|
||||
: check-self-inheritance ( class1 class2 -- class1 class2 )
|
||||
2dup = [ bad-inheritance ] when ;
|
||||
|
||||
: parse-tuple-definition ( -- class superclass slots )
|
||||
CREATE-CLASS
|
||||
scan {
|
||||
scan 2dup = [ ] when {
|
||||
{ ";" [ tuple f ] }
|
||||
{ "<" [ scan-word [ parse-tuple-slots ] { } make ] }
|
||||
{ "<" [
|
||||
scan-word check-self-inheritance [ parse-tuple-slots ] { } make
|
||||
] }
|
||||
[ tuple swap [ parse-slot-name [ parse-tuple-slots ] when ] { } make ]
|
||||
} case
|
||||
dup check-duplicate-slots
|
||||
|
|
Loading…
Reference in New Issue