summaryrefslogtreecommitdiff
path: root/astroid/arguments.py
diff options
context:
space:
mode:
authorBryce Guinta <bryce.paul.guinta@gmail.com>2018-06-20 21:59:47 -0600
committerBryce Guinta <bryce.guinta@protonmail.com>2018-07-05 23:17:06 -0600
commitaea774e9554877871045f7f5d0a2f6e063a7c756 (patch)
tree4da5ffea7c605082a54874fdb685256bd3bd4ca5 /astroid/arguments.py
parent904734c383be4a7e11c8ed16e130d0dff5f56526 (diff)
downloadastroid-git-aea774e9554877871045f7f5d0a2f6e063a7c756.tar.gz
Fix inference for nested calls
Add context_lookup to the context class as extra_context. Deliver the correct context with the correct boundnode for function argument nodes. Close #177
Diffstat (limited to 'astroid/arguments.py')
-rw-r--r--astroid/arguments.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/astroid/arguments.py b/astroid/arguments.py
index ebf581d6..08620644 100644
--- a/astroid/arguments.py
+++ b/astroid/arguments.py
@@ -22,7 +22,10 @@ class CallSite:
and the argument name.
"""
- def __init__(self, callcontext):
+ def __init__(self, callcontext, argument_context_map=None):
+ if argument_context_map is None:
+ argument_context_map = {}
+ self.argument_context_map = argument_context_map
args = callcontext.args
keywords = callcontext.keywords
self.duplicated_keywords = set()
@@ -68,6 +71,7 @@ class CallSite:
def _unpack_keywords(self, keywords):
values = {}
context = contextmod.InferenceContext()
+ context.extra_context = self.argument_context_map
for name, value in keywords:
if name is None:
# Then it's an unpacking operation (**)
@@ -104,10 +108,10 @@ class CallSite:
values[name] = value
return values
- @staticmethod
- def _unpack_args(args):
+ def _unpack_args(self, args):
values = []
context = contextmod.InferenceContext()
+ context.extra_context = self.argument_context_map
for arg in args:
if isinstance(arg, nodes.Starred):
try: