diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-05-01 19:20:47 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-05-01 19:20:47 +0900 |
| commit | 8b13e3c32792f1bfa82a6d86d2838e689682243d (patch) | |
| tree | bd43c6570a0673da5998936cebd516d1d4ad37da /src/misc | |
| parent | Refactoring (diff) | |
| download | sharkey-8b13e3c32792f1bfa82a6d86d2838e689682243d.tar.gz sharkey-8b13e3c32792f1bfa82a6d86d2838e689682243d.tar.bz2 sharkey-8b13e3c32792f1bfa82a6d86d2838e689682243d.zip | |
Refactor
Diffstat (limited to 'src/misc')
| -rw-r--r-- | src/misc/aiscript/type-checker.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/misc/aiscript/type-checker.ts b/src/misc/aiscript/type-checker.ts index 4b8582ed7b..35dee36bf1 100644 --- a/src/misc/aiscript/type-checker.ts +++ b/src/misc/aiscript/type-checker.ts @@ -32,7 +32,7 @@ export class ASTypeChecker { for (let i = 0; i < def.in.length; i++) { const arg = def.in[i]; - const type = this.typeInference(v.args[i]); + const type = this.infer(v.args[i]); if (type === null) continue; if (typeof arg === 'number') { @@ -68,7 +68,7 @@ export class ASTypeChecker { for (let i = 0; i < def.in.length; i++) { const arg = def.in[i]; - const type = this.typeInference(v.args[i]); + const type = this.infer(v.args[i]); if (type === null) continue; if (typeof arg === 'number') { @@ -86,7 +86,7 @@ export class ASTypeChecker { } @autobind - public typeInference(v: Block): Type | null { + public infer(v: Block): Type | null { if (v.type === null) return null; if (v.type === 'text') return 'string'; if (v.type === 'multiLineText') return 'string'; @@ -95,7 +95,7 @@ export class ASTypeChecker { if (v.type === 'ref') { const variable = this.variables.find(va => va.name === v.value); if (variable) { - return this.typeInference(variable); + return this.infer(variable); } const pageVar = this.pageVars.find(va => va.name === v.value); @@ -120,7 +120,7 @@ export class ASTypeChecker { for (let i = 0; i < def.in.length; i++) { const arg = def.in[i]; if (typeof arg === 'number') { - const type = this.typeInference(v.args[i]); + const type = this.infer(v.args[i]); if (generic[arg] === undefined) { generic[arg] = type; @@ -142,7 +142,7 @@ export class ASTypeChecker { @autobind public getVarsByType(type: Type | null): Variable[] { if (type == null) return this.variables; - return this.variables.filter(x => (this.typeInference(x) === null) || (this.typeInference(x) === type)); + return this.variables.filter(x => (this.infer(x) === null) || (this.infer(x) === type)); } @autobind |