diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-05-01 19:50:52 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-05-01 19:50:52 +0900 |
| commit | e76e358d98312b248f16637b32c22196b51aeb0f (patch) | |
| tree | eca2a8202310c2f3ee7f82772cb15802dc8428b3 /src/misc | |
| parent | :art: (diff) | |
| download | sharkey-e76e358d98312b248f16637b32c22196b51aeb0f.tar.gz sharkey-e76e358d98312b248f16637b32c22196b51aeb0f.tar.bz2 sharkey-e76e358d98312b248f16637b32c22196b51aeb0f.zip | |
Fix bug
Diffstat (limited to 'src/misc')
| -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)); |