refactor: bye typed context
This commit is contained in:
parent
8ef041c149
commit
da728200c5
|
@ -65,35 +65,8 @@ class Context extends Map {
|
|||
}
|
||||
}
|
||||
|
||||
class TypedContext extends Context {
|
||||
|
||||
constructor(iterator) {
|
||||
super(iterator);
|
||||
|
||||
this.types = {};
|
||||
}
|
||||
|
||||
add(key, value, type) {
|
||||
super.add(key, value);
|
||||
if (!type) {
|
||||
return;
|
||||
}
|
||||
this.types = {
|
||||
...this.types,
|
||||
[key]: type,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export function createContext() {
|
||||
const context = new Context();
|
||||
context.add('global', new Globals());
|
||||
return context;
|
||||
}
|
||||
|
||||
export function createTypedContext() {
|
||||
const context = new TypedContext();
|
||||
context.add('global', new Globals(), 'globals');
|
||||
return context;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export {createContext, createTypedContext} from './context';
|
||||
export {createContext} from './context';
|
||||
export {TypeMap} from './context/types';
|
||||
export {
|
||||
get as getType,
|
||||
|
|
Loading…
Reference in New Issue
Block a user