Builder in constructor aruguments + tests.

This commit is contained in:
Paul van Brenk
2015-01-20 15:26:14 -08:00
parent 4892381ab7
commit 832af682ed
5 changed files with 16 additions and 23 deletions

View File

@@ -656,12 +656,10 @@ module FourSlash {
}
}
public verifyCompletionListIsBuilder(negative: boolean) {
public verifyCompletionListHasBuilder(negative: boolean) {
var completions = this.getCompletionListAtCaret();
if (!completions) {
this.raiseError("Expected completion list");
} else if ((completions && !completions.isBuilder) && !negative) {
if ((completions && !completions.isBuilder) && !negative) {
this.raiseError("Expected builder completion entry");
} else if ((completions && completions.isBuilder) && negative) {
this.raiseError("Un-expected builder completion entry");

View File

@@ -2376,9 +2376,11 @@ module ts {
// variable declarations
switch (previousToken.kind) {
case SyntaxKind.CommaToken:
return containingNodeKind === SyntaxKind.CallExpression;
return containingNodeKind === SyntaxKind.CallExpression
|| containingNodeKind === SyntaxKind.Constructor;
case SyntaxKind.OpenParenToken:
return containingNodeKind === SyntaxKind.CallExpression;
return containingNodeKind === SyntaxKind.CallExpression
|| containingNodeKind === SyntaxKind.Constructor;
case SyntaxKind.ModuleKeyword:
return true;
case SyntaxKind.DotToken:
@@ -2435,7 +2437,6 @@ module ts {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.CallSignature:
@@ -2482,7 +2483,9 @@ module ts {
case SyntaxKind.PrivateKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.DotDotDotToken:
return containingNodeKind === SyntaxKind.Parameter || containingNodeKind === SyntaxKind.PropertyDeclaration;
return containingNodeKind === SyntaxKind.Parameter
|| containingNodeKind === SyntaxKind.PropertyDeclaration
|| containingNodeKind === SyntaxKind.Constructor;
case SyntaxKind.ClassKeyword:
case SyntaxKind.EnumKeyword:

View File

@@ -10,26 +10,19 @@
////function testFunction(a, b/*parameterName4*/
////class bar1{ constructor(/*constructorParamter1*/
////class bar5{ constructor(public /*constructorParamter1*/
////class bar2{ constructor(a/*constructorParamter2*/
////class bar6{ constructor(public a/*constructorParamter2*/
////class bar3{ constructor(a, /*constructorParamter3*/
////class bar7{ constructor(private a/*constructorParamter3*/
////class bar4{ constructor(a, b/*constructorParamter4*/
////class bar8{ constructor(.../*constructorParamter4*/
////class bar5{ constructor(public /*constructorParamter5*/
////class bar6{ constructor(public a/*constructorParamter6*/
////class bar7{ constructor(private a/*constructorParamter7*/
////class bar8{ constructor(.../*constructorParamter8*/
////class bar9{ constructor(...a/*constructorParamter9*/
////class bar9{ constructor(...a/*constructorParamter5*/
test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.completionListIsEmpty();
verify.not.completionListIsBuilder();
});

View File

@@ -9,6 +9,5 @@
test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.not.completionListIsEmpty();
debugger;
verify.completionListIsBuilder();
});

View File

@@ -173,7 +173,7 @@ module FourSlashInterface {
}
public completionListIsBuilder() {
FourSlash.currentTestState.verifyCompletionListIsBuilder(this.negative);
FourSlash.currentTestState.verifyCompletionListHasBuilder(this.negative);
}
public memberListIsEmpty() {