Skip to content

Commit 15a7db5

Browse files
committed
remove experimental eval(). Eventual solution will probably change
1 parent 5010883 commit 15a7db5

2 files changed

Lines changed: 0 additions & 49 deletions

File tree

lib/scope-internal.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -84,35 +84,6 @@ function buildScopeInternal(
8484
};
8585
},
8686

87-
eval<T>(operation: () => Operation<T>): Operation<T> {
88-
return {
89-
*[Symbol.iterator]() {
90-
let { resolve, reject, operation: result } = withResolvers<T>();
91-
let routine = createCoroutine({
92-
scope,
93-
operation: function* evaluate() {
94-
try {
95-
let value = yield* operation();
96-
resolve(value);
97-
} catch (error) {
98-
reject(error as Error);
99-
}
100-
},
101-
});
102-
103-
routine.next(Ok());
104-
105-
try {
106-
return yield* result;
107-
} finally {
108-
routine.return(Ok({ exists: false }));
109-
// deno-lint-ignore no-unsafe-finally
110-
return yield* result;
111-
}
112-
},
113-
};
114-
},
115-
11687
decorate<T extends {}>(
11788
api: Api<T>,
11889
decorator: Partial<Decorate<T>>,

test/scope.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,6 @@ describe("Scope", () => {
165165
await destroy();
166166
expect(halted).toEqual(true);
167167
});
168-
169-
it("lets you evaluate operations from directly inside it", async () => {
170-
let cxt = createContext<string>("aString");
171-
172-
await run(function* () {
173-
let scope = yield* useScope();
174-
175-
let setCxt = yield* scope.spawn(function* () {
176-
yield* scope.eval(() => cxt.set("hello world!"));
177-
});
178-
179-
yield* setCxt;
180-
181-
expect(yield* cxt.get()).toEqual("hello world!");
182-
});
183-
});
184-
185-
it("can evaluate things in the global scope", async () => {
186-
await global.run(() => global.eval(function* () {}));
187-
});
188168
});
189169

190170
interface Tester {

0 commit comments

Comments
 (0)