Mercurial > repos > tabletprog
comparison modules/object.tp @ 268:123e9468d55e
Add support for invoking methods that take no arguments other than self through the relfection API
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 18 Jul 2014 09:55:19 -0700 |
parents | 75dc7161c1ca |
children | b74956a2196f |
comparison
equal
deleted
inserted
replaced
267:d2b70cba661e | 268:123e9468d55e |
---|---|
59 | 59 |
60 slot <- slot + 1 | 60 slot <- slot + 1 |
61 } | 61 } |
62 arr | 62 arr |
63 } | 63 } |
64 | |
65 llMessage: sendMessage:to withVars: { | |
66 obj <- object ptr | |
67 methodId <- obj_int32 ptr | |
68 } andCode: :methodId :obj { | |
69 mcall: (methodId num) 1 obj | |
70 } | |
64 } | 71 } |
65 getMethodDict <- { | 72 getMethodDict <- { |
66 methodDict <- dict hash | 73 methodDict <- dict hash |
67 i <- 0 | 74 i <- 0 |
68 n <- rt numMessages | 75 n <- rt numMessages |
88 ids <- rt addUnderstood: obj #[] | 95 ids <- rt addUnderstood: obj #[] |
89 ids map: :id { | 96 ids map: :id { |
90 rt methodName: id | 97 rt methodName: id |
91 } | 98 } |
92 } | 99 } |
100 | |
101 sendMessage:to <- :message :obj { | |
102 d <- getMethodDict: | |
103 d ifget: message :messageId{ | |
104 rt sendMessage: messageId to: obj | |
105 } else: { false } | |
106 } | |
93 } | 107 } |
94 } | 108 } |