mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 10:58:20 -05:00
Handled function boundaries.
This commit is contained in:
@@ -2169,7 +2169,7 @@ module ts {
|
||||
var result: ReferenceEntry[];
|
||||
|
||||
// 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) {
|
||||
case SyntaxKind.TryKeyword:
|
||||
case SyntaxKind.CatchKeyword:
|
||||
@@ -2237,6 +2237,9 @@ module ts {
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2256,7 +2259,7 @@ module ts {
|
||||
if (breakStatement.label) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
for (var owner = node.parent; owner; owner = owner.parent) {
|
||||
switch (owner.kind) {
|
||||
case SyntaxKind.ForStatement:
|
||||
@@ -2265,10 +2268,16 @@ module ts {
|
||||
case SyntaxKind.WhileStatement:
|
||||
// TODO (drosen): Handle loops!
|
||||
return undefined;
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return undefined;
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return getSwitchCaseDefaultOccurrences(<SwitchStatement>owner);
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function pushIfKeyword(keywordList: Node[], token: Node) {
|
||||
|
||||
@@ -10,18 +10,23 @@
|
||||
//// break;
|
||||
//// /*5*/cas 16:
|
||||
//// c/*3*/ase 12:
|
||||
//// function f() {
|
||||
//// br/*11*/eak;
|
||||
//// /*12*/break;
|
||||
//// }
|
||||
////}
|
||||
|
||||
////
|
||||
////sw/*6*/itch (10) {
|
||||
//// de/*7*/fault
|
||||
//// case 1:
|
||||
//// case 2
|
||||
|
||||
////
|
||||
//// c/*8*/ose 4:
|
||||
//// case 8:
|
||||
//// case 0xBEEF:
|
||||
//// bre/*9*/ak;
|
||||
//// case 16:
|
||||
//// () => bre/*10*/ak;
|
||||
////}
|
||||
|
||||
for (var i = 1; i <= test.markers().length; i++) {
|
||||
@@ -43,5 +48,10 @@ for (var i = 1; i <= test.markers().length; i++) {
|
||||
case 9:
|
||||
verify.occurrencesAtPositionCount(8);
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
verify.occurrencesAtPositionCount(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user