# HG changeset patch # User Michael Pavone # Date 1405702519 25200 # Node ID 123e9468d55ef12399a00cc9321734d6123ccc57 # Parent d2b70cba661ebb55098af37b72826e80f93da438 Add support for invoking methods that take no arguments other than self through the relfection API diff -r d2b70cba661e -r 123e9468d55e modules/object.tp --- a/modules/object.tp Fri Jul 18 00:14:22 2014 -0700 +++ b/modules/object.tp Fri Jul 18 09:55:19 2014 -0700 @@ -61,6 +61,13 @@ } arr } + + llMessage: sendMessage:to withVars: { + obj <- object ptr + methodId <- obj_int32 ptr + } andCode: :methodId :obj { + mcall: (methodId num) 1 obj + } } getMethodDict <- { methodDict <- dict hash @@ -90,5 +97,12 @@ rt methodName: id } } + + sendMessage:to <- :message :obj { + d <- getMethodDict: + d ifget: message :messageId{ + rt sendMessage: messageId to: obj + } else: { false } + } } } diff -r d2b70cba661e -r 123e9468d55e samples/reflect.tp --- a/samples/reflect.tp Fri Jul 18 00:14:22 2014 -0700 +++ b/samples/reflect.tp Fri Jul 18 09:55:19 2014 -0700 @@ -5,6 +5,7 @@ foreach: (object understoodBy: 42) :idx el{ print: el . "\n" } + print: (object sendMessage: "hex" to: 42) . "\n" 0 } }