diff options
author | fchin <Frankie.Chin@biamp.com> | 2019-11-12 12:11:12 +1000 |
---|---|---|
committer | Michael Hirsch, Ph.D <10931741+scivision@users.noreply.github.com> | 2019-11-12 09:21:10 -0500 |
commit | 4e460f04f3b2d767027c7769bab6eb8029b22422 (patch) | |
tree | 866c4d7e02601ea2e3fceb15cd4d2a34c75ad383 /mesonbuild/mparser.py | |
parent | adb4e071e688534fd7c163719f005239cd2f7c25 (diff) | |
download | meson-4e460f04f3b2d767027c7769bab6eb8029b22422.zip meson-4e460f04f3b2d767027c7769bab6eb8029b22422.tar.gz meson-4e460f04f3b2d767027c7769bab6eb8029b22422.tar.bz2 |
Fixed issue that the key's value type wasn't checked correctly.
Added two new failing tests.
Diffstat (limited to 'mesonbuild/mparser.py')
-rw-r--r-- | mesonbuild/mparser.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index 2c547d8..1baf051 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -676,16 +676,17 @@ class Parser: while not isinstance(s, EmptyNode): potential = self.current if self.accept('colon'): + key_value = self.statement() if isinstance(s, StringNode): if s.value in a.kwargs: # + 1 to colno to point to the actual string, not the opening quote raise ParseException('Duplicate dictionary key: {}'.format(s.value), self.getline(), s.lineno, s.colno + 1) - a.set_kwarg(s.value, self.statement()) - elif isinstance(s, IdNode) and isinstance(s.value, str): + a.set_kwarg(s.value, key_value) + elif isinstance(s, IdNode) and isinstance(key_value, StringNode): for key in a.kwargs: if s.value == key.value: raise ParseException('Duplicate dictionary variable key: {}'.format(s.value), self.getline(), s.lineno, s.colno) - a.set_kwarg(s, self.statement()) + a.set_kwarg(s, key_value) else: raise ParseException('Key must be a string or string variable', self.getline(), s.lineno, s.colno) potential = self.current |