Handled function boundaries.
This commit is contained in:
parent
88f37e579c
commit
3825c9b542
2 changed files with 23 additions and 4 deletions
|
@ -2169,7 +2169,7 @@ module ts {
|
||||||
var result: ReferenceEntry[];
|
var result: ReferenceEntry[];
|
||||||
|
|
||||||
// Each of these helper functions bails out if the node is undefined,
|
// Each of these helper functions bails out if the node is undefined,
|
||||||
// which is why you'll see much of this'node.parent && node.parent.parent' pattern.
|
// which is why you'll see much of this 'node.parent && node.parent.parent' pattern.
|
||||||
switch (node.kind) {
|
switch (node.kind) {
|
||||||
case SyntaxKind.TryKeyword:
|
case SyntaxKind.TryKeyword:
|
||||||
case SyntaxKind.CatchKeyword:
|
case SyntaxKind.CatchKeyword:
|
||||||
|
@ -2237,6 +2237,9 @@ module ts {
|
||||||
case SyntaxKind.DoStatement:
|
case SyntaxKind.DoStatement:
|
||||||
case SyntaxKind.WhileStatement:
|
case SyntaxKind.WhileStatement:
|
||||||
case SyntaxKind.SwitchStatement:
|
case SyntaxKind.SwitchStatement:
|
||||||
|
case SyntaxKind.FunctionExpression:
|
||||||
|
case SyntaxKind.FunctionDeclaration:
|
||||||
|
case SyntaxKind.ArrowFunction:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2256,7 +2259,7 @@ module ts {
|
||||||
if (breakStatement.label) {
|
if (breakStatement.label) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var owner = node.parent; owner; owner = owner.parent) {
|
for (var owner = node.parent; owner; owner = owner.parent) {
|
||||||
switch (owner.kind) {
|
switch (owner.kind) {
|
||||||
case SyntaxKind.ForStatement:
|
case SyntaxKind.ForStatement:
|
||||||
|
@ -2265,10 +2268,16 @@ module ts {
|
||||||
case SyntaxKind.WhileStatement:
|
case SyntaxKind.WhileStatement:
|
||||||
// TODO (drosen): Handle loops!
|
// TODO (drosen): Handle loops!
|
||||||
return undefined;
|
return undefined;
|
||||||
|
case SyntaxKind.FunctionExpression:
|
||||||
|
case SyntaxKind.FunctionDeclaration:
|
||||||
|
case SyntaxKind.ArrowFunction:
|
||||||
|
return undefined;
|
||||||
case SyntaxKind.SwitchStatement:
|
case SyntaxKind.SwitchStatement:
|
||||||
return getSwitchCaseDefaultOccurrences(<SwitchStatement>owner);
|
return getSwitchCaseDefaultOccurrences(<SwitchStatement>owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushIfKeyword(keywordList: Node[], token: Node) {
|
function pushIfKeyword(keywordList: Node[], token: Node) {
|
||||||
|
|
|
@ -10,18 +10,23 @@
|
||||||
//// break;
|
//// break;
|
||||||
//// /*5*/cas 16:
|
//// /*5*/cas 16:
|
||||||
//// c/*3*/ase 12:
|
//// c/*3*/ase 12:
|
||||||
|
//// function f() {
|
||||||
|
//// br/*11*/eak;
|
||||||
|
//// /*12*/break;
|
||||||
|
//// }
|
||||||
////}
|
////}
|
||||||
|
////
|
||||||
////sw/*6*/itch (10) {
|
////sw/*6*/itch (10) {
|
||||||
//// de/*7*/fault
|
//// de/*7*/fault
|
||||||
//// case 1:
|
//// case 1:
|
||||||
//// case 2
|
//// case 2
|
||||||
|
////
|
||||||
//// c/*8*/ose 4:
|
//// c/*8*/ose 4:
|
||||||
//// case 8:
|
//// case 8:
|
||||||
//// case 0xBEEF:
|
//// case 0xBEEF:
|
||||||
//// bre/*9*/ak;
|
//// bre/*9*/ak;
|
||||||
//// case 16:
|
//// case 16:
|
||||||
|
//// () => bre/*10*/ak;
|
||||||
////}
|
////}
|
||||||
|
|
||||||
for (var i = 1; i <= test.markers().length; i++) {
|
for (var i = 1; i <= test.markers().length; i++) {
|
||||||
|
@ -43,5 +48,10 @@ for (var i = 1; i <= test.markers().length; i++) {
|
||||||
case 9:
|
case 9:
|
||||||
verify.occurrencesAtPositionCount(8);
|
verify.occurrencesAtPositionCount(8);
|
||||||
break;
|
break;
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
case 12:
|
||||||
|
verify.occurrencesAtPositionCount(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue