Пример #1
0
 def fn():
     fieldinfo = fieldinfo_for_const(const)
     obj = fieldinfo.GetValue(None)
     # get the 'xx' field by using reflection
     t = obj.GetType()
     x_info = t.GetField('xx')
     x_value = x_info.GetValue(obj)
     return unbox(x_value, ootype.Signed)
Пример #2
0
 def fn():
     fieldinfo = fieldinfo_for_const(const)
     obj = fieldinfo.GetValue(None)
     # get the 'xx' field by using reflection
     t = obj.GetType()
     x_info = t.GetField('xx')
     x_value = x_info.GetValue(obj)
     return unbox(x_value, ootype.Signed)
Пример #3
0
 def test_fieldinfo_for_const_pbc(self):
     A = ootype.Instance('A', ootype.ROOT, {'xx': ootype.Signed})
     const = ootype.new(A)
     fieldinfo = fieldinfo_for_const(const)
     def fn():
         const.xx = 42
         obj = fieldinfo.GetValue(None)
         # get the 'xx' field by using reflection
         t = obj.GetType()
         x_info = t.GetField('xx')
         x_value = x_info.GetValue(obj)
         return unbox(x_value, ootype.Signed)
     res = self.interpret(fn, [])
     assert res == 42
Пример #4
0
 def test_fieldinfo_for_const_pbc(self):
     A = ootype.Instance('A', ootype.ROOT, {'xx': ootype.Signed})
     const = ootype.new(A)
     fieldinfo = fieldinfo_for_const(const)
     def fn():
         const.xx = 42
         obj = fieldinfo.GetValue(None)
         # get the 'xx' field by using reflection
         t = obj.GetType()
         x_info = t.GetField('xx')
         x_value = x_info.GetValue(obj)
         return unbox(x_value, ootype.Signed)
     res = self.interpret(fn, [])
     assert res == 42