Hi Marcus I'm sure this is great. Just a quick question on your example code: where is tag being defined? Is it an instance variable from ReflectiveMethodTest? Thanks - Francisco (iPhone)
On 9 Jun 2015, at 08:56, Marcus Denker <marcus.denker@inria.fr> wrote:
Hi,
The current thing I am working on for Reflectivity is to allow to pass data to the meta level. Simple things where already working (like #object, #node).
50096 now adds the first more complex feature: passing the new value to the meta for stores into variables.
Imagine you have code like this:
exampleAssignment | temp | temp := (1 + 2). ^temp
The temp is assigned a new value. Now you can pass that to the meta level, here is a simpel example:
varNode := (ReflectivityExamples>>#exampleAssignment) ast body statements first variable. link := MetaLink new metaObject: self; selector: #tagExec:; arguments: #(newValue). varNode link: link. self assert: varNode hasMetalink. self assert: (tag isNil). instance := ReflectivityExamples new . self assert: (instance exampleAssignment = 3). self assert: (tag = 3).
The byte code generated is:
21 <76> pushConstant: 1 22 <77> pushConstant: 2 23 <B0> send: + 24 <81 41> storeIntoTemp: 1 26 <20> pushConstant: ReflectiveMethodTest>>#testReifyNewValue 27 <11> pushTemp: 1 28 <E1> send: tagExec: 29 <87> pop 30 <68> popIntoTemp: 0 31 <10> pushTemp: 0 32 <7C> returnTop
Next: - #name, oldValue for all variables, #offset for temps and ivars, #binding for Globals - #arguments and #receiver for message send and methodNode - #after needs to wrap in ensure: - #use literal Variable instead of literal for referencing the meta object - â¦.
Marcus