diff --git a/kythe/typescript/indexer.ts b/kythe/typescript/indexer.ts index a7ad416743..e8358170da 100644 --- a/kythe/typescript/indexer.ts +++ b/kythe/typescript/indexer.ts @@ -1791,6 +1791,14 @@ class Visitor { if (context != null) { codeParts.push(context); } + if (ts.isParameter(varDecl) && varDecl.dotDotDotToken) { + codeParts.push({ + // TODO: this should probably be TYPE but the current renderer adds an + // unnecessary space after TYPEs + kind: MarkedSourceKind.MODIFIER, + pre_text: '...', + }); + } codeParts.push({ kind: MarkedSourceKind.IDENTIFIER, pre_text: fmtMarkedSource(this.getIdentifierForMarkedSourceNode(decl)), diff --git a/kythe/typescript/kythe.ts b/kythe/typescript/kythe.ts index 6a99a9e6a4..0d3ac1fb29 100644 --- a/kythe/typescript/kythe.ts +++ b/kythe/typescript/kythe.ts @@ -256,6 +256,7 @@ export enum MarkedSourceKind { LOOKUP_BY_TYPED, PARAMETER_LOOKUP_BY_TPARAM, LOOKUP_BY_TPARAM, + MODIFIER, } diff --git a/kythe/typescript/testdata/marked_source/rendered/function.ts b/kythe/typescript/testdata/marked_source/rendered/function.ts new file mode 100644 index 0000000000..b33d80a6db --- /dev/null +++ b/kythe/typescript/testdata/marked_source/rendered/function.ts @@ -0,0 +1,14 @@ + +//- @myFunction defines/binding MyFunction +//- MyFunction.code/rendered/qualified_name "myFunction" +//- MyFunction.code/rendered/callsite_signature "myFunction(arg)" +//- MyFunction.code/rendered/signature "myFunction(arg: string): number" +function myFunction(arg: string = '0'): number { + return 0; +} + +//- @varArgs defines/binding VarArgs +//- VarArgs.code/rendered/qualified_name "varArgs" +//- VarArgs.code/rendered/callsite_signature "varArgs(arg)" +//- VarArgs.code/rendered/signature "varArgs(...arg: any[]): void" +function varArgs(...arg: any[]) {}