diff options
| author | Ajax <commial@gmail.com> | 2015-04-22 15:05:00 +0200 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-04-22 17:59:32 +0200 |
| commit | 3805e82bfad5036c89db87fb83eb8812d658100d (patch) | |
| tree | dcd06d031c9347fcc2bcefd7830106c4fa97e6b2 /miasm2/core/sembuilder.py | |
| parent | 2e3012629d263946aa59903d14172e825a120e8a (diff) | |
| download | miasm-3805e82bfad5036c89db87fb83eb8812d658100d.tar.gz miasm-3805e82bfad5036c89db87fb83eb8812d658100d.zip | |
SemBuilder: Handle real variable declaration
Diffstat (limited to 'miasm2/core/sembuilder.py')
| -rw-r--r-- | miasm2/core/sembuilder.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/miasm2/core/sembuilder.py b/miasm2/core/sembuilder.py index 65e951bd..34271960 100644 --- a/miasm2/core/sembuilder.py +++ b/miasm2/core/sembuilder.py @@ -90,6 +90,7 @@ class SemBuilder(object): # Get the function AST parsed = ast.parse(inspect.getsource(func)) fc_ast = parsed.body[0] + argument_names = [name.id for name in fc_ast.args.args] body = [] # AffBlock of the current instruction @@ -99,6 +100,15 @@ class SemBuilder(object): if isinstance(statement, ast.Assign): src = self.transformer.visit(statement.value) dst = self.transformer.visit(statement.targets[0]) + + if (isinstance(dst, ast.Name) and + dst.id not in argument_names and + dst.id not in self.ctx): + # Real variable declaration + statement.value = src + body.append(statement) + continue + dst.ctx = ast.Load() res = ast.Call(func=ast.Name(id='ExprAff', |