diff options
Diffstat (limited to 'src/misc/aiscript')
| -rw-r--r-- | src/misc/aiscript/evaluator.ts | 10 | ||||
| -rw-r--r-- | src/misc/aiscript/type-checker.ts | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts index 0de924e81f..fef2d4f3a5 100644 --- a/src/misc/aiscript/evaluator.ts +++ b/src/misc/aiscript/evaluator.ts @@ -113,16 +113,6 @@ export class ASEvaluator { } @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 private interpolate(str: string, scope: Scope) { return str.replace(/\{(.+?)\}/g, match => { const v = scope.getState(match.slice(1, -1).trim()); diff --git a/src/misc/aiscript/type-checker.ts b/src/misc/aiscript/type-checker.ts index c40c844ea4..817e549864 100644 --- a/src/misc/aiscript/type-checker.ts +++ b/src/misc/aiscript/type-checker.ts @@ -140,6 +140,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 public getVarsByType(type: Type): Variable[] { if (type == null) return this.variables; return this.variables.filter(x => (this.infer(x) === null) || (this.infer(x) === type)); |