TS: fix missing this type in method declarations

This commit is contained in:
Asger F
2019-03-11 16:49:13 +00:00
parent 35484c0ca9
commit 146909ba13
3 changed files with 138 additions and 114 deletions

View File

@@ -1595,6 +1595,7 @@ public class TypeScriptASTConverter {
List<ITypeExpression> paramTypes = convertParameterTypes(node);
List<DecoratorList> paramDecorators = convertParameterDecorators(node);
List<TypeParameter> typeParameters = convertChildrenNotNull(node, "typeParameters");
ITypeExpression thisType = convertThisParameterType(node);
FunctionExpression method =
new FunctionExpression(
loc,
@@ -1607,7 +1608,7 @@ public class TypeScriptASTConverter {
paramTypes,
paramDecorators,
returnType,
null);
thisType);
attachSymbolInformation(method, node);
return method;
}

View File

@@ -608,146 +608,158 @@ scopenesting(#20205,#20200)
variables(#20206,"arguments",#20205)
isArgumentsObject(#20206)
#20207=*
stmts(#20207,1,#20204,-2,"{}")
#20208=@"loc,{#10000},8,19,8,20"
locations_default(#20208,#10000,8,19,8,20)
hasLocation(#20207,#20208)
stmtContainers(#20207,#20204)
typeexprs(#20207,0,#20204,-4,"C")
hasLocation(#20207,#20127)
exprContainers(#20207,#20204)
literals("C","C",#20207)
typebind(#20207,#20162)
#20208=*
stmts(#20208,1,#20204,-2,"{}")
#20209=@"loc,{#10000},8,19,8,20"
locations_default(#20209,#10000,8,19,8,20)
hasLocation(#20208,#20209)
stmtContainers(#20208,#20204)
isMethod(#20201)
#20209=*
properties(#20209,#20197,3,0,"constructor() {}")
#20210=@"loc,{#10000},7,9,7,8"
locations_default(#20210,#10000,7,9,7,8)
hasLocation(#20209,#20210)
#20211=*
exprs(#20211,0,#20209,0,"constructor")
hasLocation(#20211,#20210)
enclosingStmt(#20211,#20197)
exprContainers(#20211,#20001)
literals("constructor","constructor",#20211)
#20210=*
properties(#20210,#20197,3,0,"constructor() {}")
#20211=@"loc,{#10000},7,9,7,8"
locations_default(#20211,#10000,7,9,7,8)
hasLocation(#20210,#20211)
#20212=*
exprs(#20212,9,#20209,1,"() {}")
hasLocation(#20212,#20210)
exprs(#20212,0,#20210,0,"constructor")
hasLocation(#20212,#20211)
enclosingStmt(#20212,#20197)
exprContainers(#20212,#20001)
literals("constructor","constructor",#20212)
#20213=*
scopes(#20213,1)
scopenodes(#20212,#20213)
scopenesting(#20213,#20200)
#20214=@"var;{arguments};{#20213}"
variables(#20214,"arguments",#20213)
isArgumentsObject(#20214)
#20215=*
stmts(#20215,1,#20212,-2,"{}")
hasLocation(#20215,#20210)
stmtContainers(#20215,#20212)
isMethod(#20209)
exprs(#20213,9,#20210,1,"() {}")
hasLocation(#20213,#20211)
enclosingStmt(#20213,#20197)
exprContainers(#20213,#20001)
#20214=*
scopes(#20214,1)
scopenodes(#20213,#20214)
scopenesting(#20214,#20200)
#20215=@"var;{arguments};{#20214}"
variables(#20215,"arguments",#20214)
isArgumentsObject(#20215)
#20216=*
stmts(#20216,34,#20001,4,"interfa ... : I);\n}")
#20217=@"loc,{#10000},11,1,13,1"
locations_default(#20217,#10000,11,1,13,1)
hasLocation(#20216,#20217)
stmtContainers(#20216,#20001)
#20218=*
typeexprs(#20218,1,#20216,0,"I")
hasLocation(#20218,#20138)
enclosingStmt(#20218,#20216)
exprContainers(#20218,#20001)
literals("I","I",#20218)
typedecl(#20218,#20163)
stmts(#20216,1,#20213,-2,"{}")
hasLocation(#20216,#20211)
stmtContainers(#20216,#20213)
isMethod(#20210)
#20217=*
stmts(#20217,34,#20001,4,"interfa ... : I);\n}")
#20218=@"loc,{#10000},11,1,13,1"
locations_default(#20218,#10000,11,1,13,1)
hasLocation(#20217,#20218)
stmtContainers(#20217,#20001)
#20219=*
properties(#20219,#20216,2,0,"method(this: I);")
#20220=@"loc,{#10000},12,3,12,18"
locations_default(#20220,#10000,12,3,12,18)
hasLocation(#20219,#20220)
#20221=*
exprs(#20221,0,#20219,0,"method")
hasLocation(#20221,#20142)
enclosingStmt(#20221,#20216)
exprContainers(#20221,#20001)
literals("method","method",#20221)
typeexprs(#20219,1,#20217,0,"I")
hasLocation(#20219,#20138)
enclosingStmt(#20219,#20217)
exprContainers(#20219,#20001)
literals("I","I",#20219)
typedecl(#20219,#20163)
#20220=*
properties(#20220,#20217,2,0,"method(this: I);")
#20221=@"loc,{#10000},12,3,12,18"
locations_default(#20221,#10000,12,3,12,18)
hasLocation(#20220,#20221)
#20222=*
exprs(#20222,9,#20219,1,"method(this: I);")
hasLocation(#20222,#20220)
enclosingStmt(#20222,#20216)
exprs(#20222,0,#20220,0,"method")
hasLocation(#20222,#20142)
enclosingStmt(#20222,#20217)
exprContainers(#20222,#20001)
literals("method","method",#20222)
#20223=*
scopes(#20223,1)
scopenodes(#20222,#20223)
scopenesting(#20223,#20000)
#20224=@"var;{arguments};{#20223}"
variables(#20224,"arguments",#20223)
isArgumentsObject(#20224)
isMethod(#20219)
isAbstractMember(#20219)
#20225=*
entry_cfg_node(#20225,#20001)
#20226=@"loc,{#10000},1,1,1,0"
locations_default(#20226,#10000,1,1,1,0)
hasLocation(#20225,#20226)
exprs(#20223,9,#20220,1,"method(this: I);")
hasLocation(#20223,#20221)
enclosingStmt(#20223,#20217)
exprContainers(#20223,#20001)
#20224=*
scopes(#20224,1)
scopenodes(#20223,#20224)
scopenesting(#20224,#20000)
#20225=@"var;{arguments};{#20224}"
variables(#20225,"arguments",#20224)
isArgumentsObject(#20225)
#20226=*
typeexprs(#20226,0,#20223,-4,"I")
hasLocation(#20226,#20150)
exprContainers(#20226,#20223)
literals("I","I",#20226)
typebind(#20226,#20163)
isMethod(#20220)
isAbstractMember(#20220)
#20227=*
exit_cfg_node(#20227,#20001)
hasLocation(#20227,#20157)
successor(#20216,#20227)
successor(#20212,#20209)
#20228=*
entry_cfg_node(#20228,#20212)
hasLocation(#20228,#20210)
entry_cfg_node(#20227,#20001)
#20228=@"loc,{#10000},1,1,1,0"
locations_default(#20228,#10000,1,1,1,0)
hasLocation(#20227,#20228)
#20229=*
exit_cfg_node(#20229,#20212)
hasLocation(#20229,#20210)
successor(#20215,#20229)
successor(#20228,#20215)
successor(#20211,#20212)
successor(#20209,#20197)
successor(#20204,#20201)
exit_cfg_node(#20229,#20001)
hasLocation(#20229,#20157)
successor(#20217,#20229)
successor(#20213,#20210)
#20230=*
entry_cfg_node(#20230,#20204)
#20231=@"loc,{#10000},8,3,8,2"
locations_default(#20231,#10000,8,3,8,2)
hasLocation(#20230,#20231)
entry_cfg_node(#20230,#20213)
hasLocation(#20230,#20211)
#20231=*
exit_cfg_node(#20231,#20213)
hasLocation(#20231,#20211)
successor(#20216,#20231)
successor(#20230,#20216)
successor(#20212,#20213)
successor(#20210,#20197)
successor(#20204,#20201)
#20232=*
exit_cfg_node(#20232,#20204)
#20233=@"loc,{#10000},8,21,8,20"
locations_default(#20233,#10000,8,21,8,20)
entry_cfg_node(#20232,#20204)
#20233=@"loc,{#10000},8,3,8,2"
locations_default(#20233,#10000,8,3,8,2)
hasLocation(#20232,#20233)
successor(#20207,#20232)
successor(#20230,#20207)
#20234=*
exit_cfg_node(#20234,#20204)
#20235=@"loc,{#10000},8,21,8,20"
locations_default(#20235,#10000,8,21,8,20)
hasLocation(#20234,#20235)
successor(#20208,#20234)
successor(#20232,#20208)
successor(#20203,#20204)
successor(#20201,#20211)
successor(#20201,#20212)
successor(#20199,#20203)
successor(#20197,#20216)
successor(#20197,#20217)
successor(#20188,#20199)
successor(#20174,#20177)
successor(#20178,#20175)
#20234=*
entry_cfg_node(#20234,#20178)
#20235=@"loc,{#10000},3,9,3,8"
locations_default(#20235,#10000,3,9,3,8)
hasLocation(#20234,#20235)
#20236=*
exit_cfg_node(#20236,#20178)
#20237=@"loc,{#10000},3,45,3,44"
locations_default(#20237,#10000,3,45,3,44)
entry_cfg_node(#20236,#20178)
#20237=@"loc,{#10000},3,9,3,8"
locations_default(#20237,#10000,3,9,3,8)
hasLocation(#20236,#20237)
successor(#20186,#20236)
#20238=*
exit_cfg_node(#20238,#20178)
#20239=@"loc,{#10000},3,45,3,44"
locations_default(#20239,#10000,3,45,3,44)
hasLocation(#20238,#20239)
successor(#20186,#20238)
successor(#20182,#20186)
successor(#20234,#20182)
successor(#20236,#20182)
successor(#20177,#20178)
successor(#20175,#20188)
successor(#20164,#20174)
#20238=*
entry_cfg_node(#20238,#20164)
hasLocation(#20238,#20226)
#20239=*
exit_cfg_node(#20239,#20164)
#20240=@"loc,{#10000},1,47,1,46"
locations_default(#20240,#10000,1,47,1,46)
hasLocation(#20239,#20240)
successor(#20172,#20239)
#20240=*
entry_cfg_node(#20240,#20164)
hasLocation(#20240,#20228)
#20241=*
exit_cfg_node(#20241,#20164)
#20242=@"loc,{#10000},1,47,1,46"
locations_default(#20242,#10000,1,47,1,46)
hasLocation(#20241,#20242)
successor(#20172,#20241)
successor(#20168,#20172)
successor(#20238,#20168)
successor(#20240,#20168)
successor(#20165,#20164)
successor(#20225,#20165)
successor(#20227,#20165)
numlines(#10000,14,9,0)
filetype(#10000,"typescript")

View File

@@ -0,0 +1,11 @@
import { Foo, Bar, Baz } from "somewhere"; // OK
export function f(this: Foo) {}
export class C {
m(this: Bar) {}
}
export default {
foo(this: Baz) {}
}