On 09 Jun 2015, at 14:55, Francisco Garau <francisco.garau@gmail.com> wrote:
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?
Yes, The test instance is put as the meta-object and we call #tagExec: there. This is just: tagExec: aTag tag := aTag. So we just call it with an argument, in this case the new value of the variable. This is in the image #testReifyNewValue.
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).
Marcus