Merge pull request #2130 from Microsoft/importBreakpoints

Support for breakpoints for the new Import/Export syntax
This commit is contained in:
Mohamed Hegazy 2015-02-24 14:35:57 -08:00
commit 7177f3b66d
5 changed files with 82 additions and 1 deletions

View file

@ -178,7 +178,15 @@ module ts.BreakpointResolver {
case SyntaxKind.ImportEqualsDeclaration:
// import statement without including semicolon
return textSpan(node,(<ImportEqualsDeclaration>node).moduleReference);
return textSpan(node, (<ImportEqualsDeclaration>node).moduleReference);
case SyntaxKind.ImportDeclaration:
// import statement without including semicolon
return textSpan(node, (<ImportDeclaration>node).moduleSpecifier);
case SyntaxKind.ExportDeclaration:
// import statement without including semicolon
return textSpan(node, (<ExportDeclaration>node).moduleSpecifier);
case SyntaxKind.ModuleDeclaration:
// span on complete module if it is instantiated

View file

@ -0,0 +1,17 @@
1 >export * from "a";
~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17}
>export * from "a"
>:=> (line 1, col 0) to (line 1, col 17)
--------------------------------
2 >export {a as A} from "a";
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (19 to 44) SpanInfo: {"start":19,"length":24}
>export {a as A} from "a"
>:=> (line 2, col 0) to (line 2, col 24)
--------------------------------
3 >export import e = require("a");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (45 to 75) SpanInfo: {"start":45,"length":30}
>export import e = require("a")
>:=> (line 3, col 0) to (line 3, col 30)

View file

@ -0,0 +1,35 @@
1 >import * as NS from "a";
~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 24) SpanInfo: {"start":0,"length":23}
>import * as NS from "a"
>:=> (line 1, col 0) to (line 1, col 23)
--------------------------------
2 >import {a as A} from "a";
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (25 to 50) SpanInfo: {"start":25,"length":24}
>import {a as A} from "a"
>:=> (line 2, col 0) to (line 2, col 24)
--------------------------------
3 > import d from "a";
~~~~~~~~~~~~~~~~~~~~ => Pos: (51 to 70) SpanInfo: {"start":52,"length":17}
>import d from "a"
>:=> (line 3, col 1) to (line 3, col 18)
--------------------------------
4 >import d2, {c, d as D} from "a";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (71 to 103) SpanInfo: {"start":71,"length":31}
>import d2, {c, d as D} from "a"
>:=> (line 4, col 0) to (line 4, col 31)
--------------------------------
5 >import "a";
~~~~~~~~~~~~ => Pos: (104 to 115) SpanInfo: {"start":104,"length":10}
>import "a"
>:=> (line 5, col 0) to (line 5, col 10)
--------------------------------
6 >import e = require("a");
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (116 to 139) SpanInfo: {"start":116,"length":23}
>import e = require("a")
>:=> (line 6, col 0) to (line 6, col 23)

View file

@ -0,0 +1,9 @@
/// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_exports.baseline
// @Filename: bpSpan_exports.ts
////export * from "a";
////export {a as A} from "a";
////export import e = require("a");
verify.baselineCurrentFileBreakpointLocations();

View file

@ -0,0 +1,12 @@
/// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_imports.baseline
// @Filename: bpSpan_imports.ts
////import * as NS from "a";
////import {a as A} from "a";
//// import d from "a";
////import d2, {c, d as D} from "a";
////import "a";
////import e = require("a");
verify.baselineCurrentFileBreakpointLocations();