HomePhabricator

Use scope attached to ZWrapper instead of passing it around everywhere.

Description

Use scope attached to ZWrapper instead of passing it around everywhere.

Resolving objects and subobjects can modify the local scope by adding new arguments to it. We therefore need to remember to use the correct scope for each object and subobject. Passing around scopes as variables everywhere makes it easy to use the wrong scope in a function, or forget to retrieve the newly modified scope from the result.

This change:

  • Makes sure that a scope is always attached to ZWrappers by requiring it at construction time.
  • Uses that scope for resolution instead of passing the scope around everywhere.

Doing so ensures that we are always using the correct scope and that we are not losing any information when resolving subobjects.

How to review:

  • Start with ZWrapper.js to see how it was modified to always require an attached scope.
  • Calls to ZWrapper.create() now provide an additional scope argument. Check that the provided scope makes sense.
  • Calls to other functions no longer pass scopes around. The scope in the ZWrapper is used where needed instead.

Bug: T309195
Change-Id: Ic2ded6232490ffe74439b161dcab21ae9449ca8d

Details

Provenance
AAssafAuthored on Jun 22 2022, 2:40 PM
Parents
rMSFO46b0384b6a06: Fix scoping in orchestrator.
Branches
Unknown
Tags
Unknown
References
refs/changes/26/813226/6
ChangeId
Ic2ded6232490ffe74439b161dcab21ae9449ca8d