Skip to content

Commit

Permalink
refactor(runtime): drop dead branches in Sandbox#push method
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip committed Feb 4, 2024
1 parent dc4f2f8 commit 86e7236
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/runtime/sandbox.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import isObject from './codegen-functions/is-object.mjs';

function printSegment(path, segment) {
return path + `[${typeof segment === 'string' ? `'${segment}'` : segment}]`;
}
Expand Down Expand Up @@ -50,13 +48,8 @@ export class Sandbox {

push() {
const length = this.#path.length;

this.property = length === 0 ? null : this.#path[length - 1];

const root =
this.property !== null && isObject(this.value)
? this.value[this.property]
: null;
this.property = this.#path[length - 1];
const root = this.value[this.property];

if (length + 1 > this.#history.length) {
this.#history.push(root);
Expand Down

0 comments on commit 86e7236

Please sign in to comment.