Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Remove decodeAll; mark _runSaga as private.
Browse files Browse the repository at this point in the history
  • Loading branch information
haltman-at committed Apr 10, 2019
1 parent d967de8 commit 4da769c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
10 changes: 0 additions & 10 deletions packages/truffle-debugger/lib/data/sagas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,6 @@ export function* decode(definition, ref) {
return DecodeUtils.Conversion.cleanContainers(result.value);
}

export function* decodeAll() {
let definitions = yield select(data.current.identifiers.definitions);
let refs = yield select(data.current.identifiers.refs);
let decoded = {};
for (let [identifier, ref] of Object.entries(refs)) {
decoded[identifier] = yield* decode(definitions[identifier], ref);
}
return decoded;
}

function* variablesAndMappingsSaga() {
let node = yield select(data.current.node);
let scopes = yield select(data.views.scopes.inlined);
Expand Down
24 changes: 20 additions & 4 deletions packages/truffle-debugger/lib/session/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import configureStore from "lib/store";
import * as controller from "lib/controller/actions";
import * as actions from "./actions";
import data from "lib/data/selectors";
import { decode, decodeAll } from "lib/data/sagas";
import { decode } from "lib/data/sagas";
import controllerSelector from "lib/controller/selectors";

import rootSaga from "./sagas";
Expand Down Expand Up @@ -148,7 +148,13 @@ export default class Session {
return true;
}

async runSaga(saga, ...args) {
/**
* @private
* Allows running any saga -- for internal use only!
* Using this could seriously screw up the debugger state if you
* don't know what you're doing!
*/
async _runSaga(saga, ...args) {
return await this._sagaMiddleware.run(saga, ...args).toPromise();
}

Expand Down Expand Up @@ -235,10 +241,20 @@ export default class Session {
const definitions = this.view(data.current.identifiers.definitions);
const refs = this.view(data.current.identifiers.refs);

return await this.runSaga(decode, definitions[name], refs[name]);
return await this._runSaga(decode, definitions[name], refs[name]);
}

async variables() {
return await this.runSaga(decodeAll);
let definitions = this.view(data.current.identifiers.definitions);
let refs = this.view(data.current.identifiers.refs);
let decoded = {};
for (let [identifier, ref] of Object.entries(refs)) {
decoded[identifier] = await this._runSaga(
decode,
definitions[identifier],
ref
);
}
return decoded;
}
}

0 comments on commit 4da769c

Please sign in to comment.