aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.py
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2023-02-26 20:13:56 -0500
committerSimon Marchi <simon.marchi@efficios.com>2023-02-27 13:28:32 -0500
commitc4e1b10cc2e84eaf574842907e4c35ad51eb5792 (patch)
tree649b7f7aabab7dcf263c4a724c1b89a299bab40f /gdb/gdbarch.py
parent09de95fbb79c31b1b163a0c19bc1f0cd428c5d8c (diff)
downloadgdb-c4e1b10cc2e84eaf574842907e4c35ad51eb5792.zip
gdb-c4e1b10cc2e84eaf574842907e4c35ad51eb5792.tar.gz
gdb-c4e1b10cc2e84eaf574842907e4c35ad51eb5792.tar.bz2
gdb: gdbarch.py: spell out parameters of _Component.__init__
The way _Component uses kwargs is handy to save a few characters, but it doesn't play well with static analysis. When editing gdbarch.py, my editor (which uses pylance under the hood) knows nothing about the properties of components. So it's full of squiggly lines, and typing analysis (which I find really helpful) doesn't work. I therefore think it would be better to spell out the parameters. Change-Id: Iaf561beb0d0fbe170ce1c79252a291e0945e1830 Reviewed-By: Tom Tromey <tom@tromey.com> Reviewed-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/gdbarch.py')
-rwxr-xr-xgdb/gdbarch.py35
1 files changed, 30 insertions, 5 deletions
diff --git a/gdb/gdbarch.py b/gdb/gdbarch.py
index 68c7bba..63c3aee 100755
--- a/gdb/gdbarch.py
+++ b/gdb/gdbarch.py
@@ -49,9 +49,34 @@ def join_params(params):
class _Component:
"Base class for all components."
- def __init__(self, **kwargs):
- for key in kwargs:
- setattr(self, key, kwargs[key])
+ def __init__(
+ self,
+ name,
+ type,
+ printer,
+ comment=None,
+ predicate=False,
+ predefault=None,
+ postdefault=None,
+ invalid=None,
+ params=None,
+ param_checks=None,
+ result_checks=None,
+ implement=True,
+ ):
+ self.name = name
+ self.type = type
+ self.printer = printer
+ self.comment = comment
+ self.predicate = predicate
+ self.predefault = predefault
+ self.postdefault = postdefault
+ self.invalid = invalid
+ self.params = params
+ self.param_checks = param_checks
+ self.result_checks = result_checks
+ self.implement = implement
+
components.append(self)
# It doesn't make sense to have a check of the result value
@@ -87,7 +112,7 @@ class Value(_Component):
name,
type,
comment=None,
- predicate=None,
+ predicate=False,
predefault=None,
postdefault=None,
invalid=None,
@@ -115,7 +140,7 @@ class Function(_Component):
type,
params,
comment=None,
- predicate=None,
+ predicate=False,
predefault=None,
postdefault=None,
invalid=None,