Breakpoints in import declaration

This commit is contained in:
Sheetal Nandi 2014-09-02 16:10:08 -07:00
parent 2905217d4e
commit d235caf990
3 changed files with 46 additions and 0 deletions

View file

@ -122,6 +122,9 @@ module ts.BreakpointResolver {
case SyntaxKind.ExportAssignment:
return spanInExportAssignment(<ExportAssignment>node);
case SyntaxKind.ImportDeclaration:
return spanInImportDeclaration(<ImportDeclaration>node);
case SyntaxKind.BinaryExpression:
case SyntaxKind.PostfixOperator:
case SyntaxKind.PrefixOperator:
@ -358,6 +361,10 @@ module ts.BreakpointResolver {
return textSpan(exportAssignment, exportAssignment.exportName);
}
function spanInImportDeclaration(importDeclaration: ImportDeclaration): TypeScript.TextSpan {
return textSpan(importDeclaration, importDeclaration.entityName || importDeclaration.externalModuleName);
}
function spanInExpression(expression: Expression): TypeScript.TextSpan {
//TODO (pick this up later) for now lets fix do-while baseline if (node.parent.kind === SyntaxKind.DoStatement) {
// Set span as if on while keyword

View file

@ -0,0 +1,39 @@
1 >module m {
~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: undefined
--------------------------------
2 > class c {
~~~~~~~~~~~~~~ => Pos: (11 to 24) SpanInfo: undefined
--------------------------------
3 > }
~~~~~~ => Pos: (25 to 30) SpanInfo: undefined
--------------------------------
4 >}
~~ => Pos: (31 to 32) SpanInfo: undefined
--------------------------------
5 >import a = m.c;
~~~~~~~~~~~~~~~~ => Pos: (33 to 48) SpanInfo: {"start":33,"length":14}
>import a = m.c
>:=> (line 5, col 0) to (line 5, col 14)
--------------------------------
6 >export import b = m.c;
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (49 to 71) SpanInfo: {"start":49,"length":21}
>export import b = m.c
>:=> (line 6, col 0) to (line 6, col 21)
--------------------------------
7 >var x = new a();
~~~~~~~~~~~~~~~~~ => Pos: (72 to 88) SpanInfo: {"start":72,"length":15}
>var x = new a()
>:=> (line 7, col 0) to (line 7, col 15)
--------------------------------
8 >var y = new b();
~~~~~~~~~~~~~~~~ => Pos: (89 to 104) SpanInfo: {"start":89,"length":15}
>var y = new b()
>:=> (line 8, col 0) to (line 8, col 15)