diff options
| author | Ajax <commial@gmail.com> | 2015-11-16 17:38:24 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-11-16 17:38:24 +0100 |
| commit | c4b3c10c7a63e4222310afa057092205490c5c36 (patch) | |
| tree | b002ea616345fddb280ee1858c789101630666b9 /miasm2/core/sembuilder.py | |
| parent | 7ceb97bcb90ca809f9afea68367c5d34af01d0a7 (diff) | |
| download | miasm-c4b3c10c7a63e4222310afa057092205490c5c36.tar.gz miasm-c4b3c10c7a63e4222310afa057092205490c5c36.zip | |
SemBuilder: use a local context per function
Diffstat (limited to 'miasm2/core/sembuilder.py')
| -rw-r--r-- | miasm2/core/sembuilder.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/miasm2/core/sembuilder.py b/miasm2/core/sembuilder.py index 2bf8ba2c..b2cbb0ad 100644 --- a/miasm2/core/sembuilder.py +++ b/miasm2/core/sembuilder.py @@ -151,12 +151,13 @@ class SemBuilder(object): if (isinstance(dst, ast.Name) and dst.id not in argument_names and - dst.id not in self._ctx): + dst.id not in self._ctx and + dst.id not in self._local_ctx): # Real variable declaration statement.value = src real_body.append(statement) - self._ctx[dst.id] = src + self._local_ctx[dst.id] = src continue dst.ctx = ast.Load() @@ -266,6 +267,9 @@ class SemBuilder(object): fc_ast = parsed.body[0] argument_names = [name.id for name in fc_ast.args.args] + # Init local cache + self._local_ctx = {} + # Translate (blocks[0][0] is the current instr) blocks, body = self._parse_body(fc_ast.body, argument_names) |