Skip to content

Commit

Permalink
fix: getting referenced binding
Browse files Browse the repository at this point in the history
  • Loading branch information
iAmMichaelConnor committed May 17, 2021
1 parent a891aa3 commit 4f4f423
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/transformers/visitors/toContractVisitor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ export default {
Assignment: {
enter(path, state) {
const { node, parent, scope } = path;
const binding = scope.getReferencedBinding(
node.leftHandSide.baseExpression,
); // HACK - only works for one very specific example. We should instead create an `interactsWithSecret` indicator and attach it to any node with a child (or grandchild etc) which isSecret. That way, we could just do node.interactsWithSecret() within this function (and others), which would be clean.

const binding = scope.getReferencedBinding(node.leftHandSide); // HACK - only works for one very specific example. We should instead create an `interactsWithSecret` indicator and attach it to any node with a child (or grandchild etc) which isSecret. That way, we could just do node.interactsWithSecret() within this function (and others), which would be clean.

if (binding?.isSecret) {
// Don't copy over code which should be secret! It shouldn't appear in a public shield contract; only in the circuit! So skip subnodes.
state.skipSubNodes = true;
Expand Down

0 comments on commit 4f4f423

Please sign in to comment.