You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor so builder context only stores Blocks (#432)
Having context be any Refable was overkill and didn't do anything except
for one clone check, This changes builder context to only store Blocks
(including Links), and has the context push happen in the init
metaclass.
Other changes:
- Renames ConstraintExpr.parent to ConstraintExpr._context, since parent
in Block and Port refer to a binding, whereas the Constraint binding is
stored in the Binding object.
- Changes the `__init__` hook to unconditionally pass through args and
kwargs, instead of looking for *args, **kwargs.
- Prevents builder double-pushing the same context.
- Ensure the dummy instantiation of part libraries are in lambdas,
otherwise they were being created on program start
"""Returns a clone of this object with the specified binding. This object must be unbound."""
82
83
assertnotself._is_bound()
83
-
assertbuilder.get_curr_context() isself.parent, f"can't clone in original context {self.parent} to different new context {builder.get_curr_context()}"
84
+
assertbuilder.get_enclosing_block() isself._context, f"can't clone in original context {self._context} to different new context {builder.get_enclosing_block()}"
84
85
ifnotisinstance(binding, ParamBinding):
85
86
assertself.initializerisNone, "Only Parameters may have initializers"
0 commit comments