forked from FoundKeyGang/FoundKey
Fix bug
This commit is contained in:
parent
76f37671b4
commit
e76e358d98
2 changed files with 10 additions and 10 deletions
|
@ -112,16 +112,6 @@ export class ASEvaluator {
|
||||||
this.envVars.SEED = seed;
|
this.envVars.SEED = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
|
||||||
public getVarByName(name: string): Variable {
|
|
||||||
const v = this.variables.find(x => x.name === name);
|
|
||||||
if (v !== undefined) {
|
|
||||||
return v;
|
|
||||||
} else {
|
|
||||||
throw new AiScriptError(`No such variable '${name}'`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
private interpolate(str: string, scope: Scope) {
|
private interpolate(str: string, scope: Scope) {
|
||||||
return str.replace(/\{(.+?)\}/g, match => {
|
return str.replace(/\{(.+?)\}/g, match => {
|
||||||
|
|
|
@ -139,6 +139,16 @@ export class ASTypeChecker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
public getVarByName(name: string): Variable {
|
||||||
|
const v = this.variables.find(x => x.name === name);
|
||||||
|
if (v !== undefined) {
|
||||||
|
return v;
|
||||||
|
} else {
|
||||||
|
throw new Error(`No such variable '${name}'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public getVarsByType(type: Type): Variable[] {
|
public getVarsByType(type: Type): Variable[] {
|
||||||
if (type == null) return this.variables;
|
if (type == null) return this.variables;
|
||||||
|
|
Loading…
Reference in a new issue