Skip to content

Commit ac0d9f7

Browse files
authored
Add properties for Attr and Annotation (#20)
1 parent 95e606d commit ac0d9f7

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/bap/bir.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,16 @@ class Attrs(Map) :
248248
class Attr(ADT) :
249249
"""Attribute is a pair of attribute name and value,
250250
both represented with str"""
251-
pass
251+
252+
@property
253+
def name(self):
254+
"""name of attribute"""
255+
return self.arg[0]
256+
257+
@property
258+
def value(self):
259+
"""value of attribute"""
260+
return self.arg[1]
252261

253262
class Values(Map) :
254263
"""A set of possible values, taken by a phi-node.
@@ -362,7 +371,15 @@ class Annotation(ADT) :
362371
Each annotation denotes an association between a memory region and
363372
some arbitrary property, denoted with an attribute.
364373
"""
365-
pass
374+
@property
375+
def region(self):
376+
"""memory region"""
377+
return self.arg[0]
378+
379+
@property
380+
def attr(self):
381+
"""memory region attribute"""
382+
return self.arg[1]
366383

367384
def parse_addr(str):
368385
return int(str.split(':')[0],16)

0 commit comments

Comments
 (0)