idlize
47 строк · 1.5 Кб
1/*
2* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15import { log } from "./util.test";
16export class Node {
17}
18export class MutableState<T> {
19constructor(public value: T) {
20this.value = value;
21}
22}
23export function __context(): Context {
24throw "__context() should not be called";
25}
26export function __id<Key>(): Key {
27throw "__id() should not be called";
28}
29export class Scope<T> {
30param<T>(index: number, value: T): MutableState<T> {
31return new MutableState(value);
32}
33recache<T>(value: T) { return value; }
34get cached() {
35throw new Error("");
36}
37unchanged = false;
38}
39export class Context {
40scope<T>(id: Key, paramCount: number = 0): Scope<T> { return new Scope<T>(); }
41compute<T>(id: Key, lambda: () => T): T {
42return lambda();
43}
44}
45export type Key = string;
46export type __memo_context_type = Context;
47export type __memo_id_type = Key;
48
49