コード例 #1
0
ファイル: test_dotnet.py プロジェクト: griels/pypy-sc
 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