1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays kernel sequences sets smalltalk.ast ;
4 IN: smalltalk.compiler.assignment
6 GENERIC: assigned-locals ( ast -- seq )
8 M: ast-return assigned-locals value>> assigned-locals ;
10 M: ast-block assigned-locals
11 [ body>> assigned-locals ] [ arguments>> ] bi diff ;
13 M: ast-message-send assigned-locals
14 [ receiver>> assigned-locals ]
15 [ arguments>> assigned-locals ]
18 M: ast-cascade assigned-locals
19 [ receiver>> assigned-locals ]
20 [ messages>> assigned-locals ]
23 M: ast-message assigned-locals
24 arguments>> assigned-locals ;
26 M: ast-assignment assigned-locals
27 [ name>> dup ast-name? [ name>> 1array ] [ drop { } ] if ]
28 [ value>> assigned-locals ] bi append ;
30 M: ast-sequence assigned-locals
31 body>> assigned-locals ;
33 M: array assigned-locals
34 [ assigned-locals ] map concat ;
36 M: object assigned-locals drop f ;