-
Notifications
You must be signed in to change notification settings - Fork 70
/
environment.js
50 lines (39 loc) · 1.17 KB
/
environment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const helperIseDeclarations = require("./helperise/registeredHelperIse.js");
class Environment {
constructor () {
this.vars = {};
this.iseDeclarations = {};
}
setJeki (scope, name, value) {
if (this.vars[scope] == undefined) {
this.vars[scope] = {};
}
this.vars[scope][name] = value;
}
getJeki (scope, name) {
if (this.vars[scope] != undefined) { return this.vars[scope][name]; }
}
setIse (scope, iseName, iseNode) {
if (this.iseDeclarations[scope] == undefined) {
this.iseDeclarations[scope] = {};
}
this.iseDeclarations[scope][iseName] = iseNode;
}
getIse (scope, iseName) {
if (this.iseDeclarations[scope] != undefined) {
return this.iseDeclarations[scope][iseName];
}
}
isExistHelperIse (iseName) {
return helperIseDeclarations[iseName] != undefined;
}
runHelperIse (iseName, iseArgs) {
if (this.isExistHelperIse(iseName)) {
return helperIseDeclarations[iseName](iseArgs);
}
}
sope (value) {
console.log(value);
}
}
module.exports = Environment;