mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Breakpoints in enum declaration
This commit is contained in:
@@ -125,6 +125,12 @@ module ts.BreakpointResolver {
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
return spanInImportDeclaration(<ImportDeclaration>node);
|
||||
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return spanInEnumDeclaration(<EnumDeclaration>node);
|
||||
|
||||
case SyntaxKind.EnumMember:
|
||||
return spanInEnumMember(<EnumMember>node);
|
||||
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.PostfixOperator:
|
||||
case SyntaxKind.PrefixOperator:
|
||||
@@ -365,6 +371,19 @@ module ts.BreakpointResolver {
|
||||
return textSpan(importDeclaration, importDeclaration.entityName || importDeclaration.externalModuleName);
|
||||
}
|
||||
|
||||
function spanInEnumDeclaration(enumDeclaration: EnumDeclaration): TypeScript.TextSpan {
|
||||
if (enumDeclaration.members.length) {
|
||||
return spanInEnumMember(enumDeclaration.members[0]);
|
||||
}
|
||||
|
||||
// On close brace
|
||||
return spanInNode(enumDeclaration.getLastToken(sourceFile));
|
||||
}
|
||||
|
||||
function spanInEnumMember(enumMember: EnumMember) {
|
||||
return textSpan(enumMember);
|
||||
}
|
||||
|
||||
function spanInExpression(expression: Expression): TypeScript.TextSpan {
|
||||
//TODO (pick this up later) for now lets fix do-while baseline
|
||||
if (node.parent.kind === SyntaxKind.DoStatement) {
|
||||
@@ -385,6 +404,7 @@ module ts.BreakpointResolver {
|
||||
function spanInCommaToken(node: Node): TypeScript.TextSpan {
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return spanInPreviousNode(node);
|
||||
|
||||
@@ -417,6 +437,7 @@ module ts.BreakpointResolver {
|
||||
|
||||
function spanInCloseBraceToken(node: Node): TypeScript.TextSpan {
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
// Span on close brace token
|
||||
return textSpan(node);
|
||||
|
||||
Reference in New Issue
Block a user