mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2025-03-02 17:17:45 +00:00
Emit new lines between source files emit so that the file contents always start on new line
Fixes #500
This commit is contained in:
parent
753364768e
commit
3e2de14933
@ -1925,6 +1925,8 @@ module ts {
|
||||
|
||||
function emitSourceFile(node: SourceFile) {
|
||||
currentSourceFile = node;
|
||||
// Start new file on new line
|
||||
writeLine();
|
||||
emitDetachedComments(node);
|
||||
// emit prologue directives prior to __extends
|
||||
var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false);
|
||||
|
@ -0,0 +1,34 @@
|
||||
//// [tests/cases/compiler/sourceMapWithMultipleFilesWithCopyright.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
/*--------------------------------------------------------------------------
|
||||
Copyright
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
var x = {
|
||||
a: 10,
|
||||
b: 20
|
||||
};
|
||||
|
||||
//// [b.ts]
|
||||
/*--------------------------------------------------------------------------
|
||||
Copyright
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
///<reference path="a.ts"/>
|
||||
var y = x;
|
||||
|
||||
//// [a.js]
|
||||
/*--------------------------------------------------------------------------
|
||||
Copyright
|
||||
---------------------------------------------------------------------------*/
|
||||
var x = {
|
||||
a: 10,
|
||||
b: 20
|
||||
};
|
||||
/*--------------------------------------------------------------------------
|
||||
Copyright
|
||||
---------------------------------------------------------------------------*/
|
||||
///<reference path="a.ts"/>
|
||||
var y = x;
|
||||
//# sourceMappingURL=a.js.map
|
@ -0,0 +1,2 @@
|
||||
//// [a.js.map]
|
||||
{"version":3,"file":"a.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":"AAAA;;6EAE6E;AAE7E,IAAI,CAAC,GAAG;IACJ,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;CACR,CAAC;ACPF;;6EAE6E;AAG7E,AADA,2BAA2B;IACvB,CAAC,GAAG,CAAC,CAAC"}
|
@ -0,0 +1,134 @@
|
||||
===================================================================
|
||||
JsFile: a.js
|
||||
mapUrl: a.js.map
|
||||
sourceRoot:
|
||||
sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:a.js
|
||||
sourceFile:tests/cases/compiler/a.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>/*--------------------------------------------------------------------------
|
||||
1 >
|
||||
2 >^^^^^^^^^^->
|
||||
1 >
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
---
|
||||
>>>Copyright
|
||||
>>>---------------------------------------------------------------------------*/
|
||||
1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->/*--------------------------------------------------------------------------
|
||||
>Copyright
|
||||
>---------------------------------------------------------------------------*/
|
||||
1->Emitted(3, 78) Source(3, 78) + SourceIndex(0)
|
||||
---
|
||||
>>>var x = {
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^^^->
|
||||
1 >
|
||||
>
|
||||
>
|
||||
2 >var
|
||||
3 > x
|
||||
4 > =
|
||||
1 >Emitted(4, 1) Source(5, 1) + SourceIndex(0)
|
||||
2 >Emitted(4, 5) Source(5, 5) + SourceIndex(0)
|
||||
3 >Emitted(4, 6) Source(5, 6) + SourceIndex(0)
|
||||
4 >Emitted(4, 9) Source(5, 9) + SourceIndex(0)
|
||||
---
|
||||
>>> a: 10,
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^
|
||||
4 > ^^
|
||||
5 > ^->
|
||||
1->{
|
||||
>
|
||||
2 > a
|
||||
3 > :
|
||||
4 > 10
|
||||
1->Emitted(5, 5) Source(6, 5) + SourceIndex(0)
|
||||
2 >Emitted(5, 6) Source(6, 6) + SourceIndex(0)
|
||||
3 >Emitted(5, 8) Source(6, 8) + SourceIndex(0)
|
||||
4 >Emitted(5, 10) Source(6, 10) + SourceIndex(0)
|
||||
---
|
||||
>>> b: 20
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^
|
||||
4 > ^^
|
||||
1->,
|
||||
>
|
||||
2 > b
|
||||
3 > :
|
||||
4 > 20
|
||||
1->Emitted(6, 5) Source(7, 5) + SourceIndex(0)
|
||||
2 >Emitted(6, 6) Source(7, 6) + SourceIndex(0)
|
||||
3 >Emitted(6, 8) Source(7, 8) + SourceIndex(0)
|
||||
4 >Emitted(6, 10) Source(7, 10) + SourceIndex(0)
|
||||
---
|
||||
>>>};
|
||||
1 >^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>}
|
||||
2 > ;
|
||||
1 >Emitted(7, 2) Source(8, 2) + SourceIndex(0)
|
||||
2 >Emitted(7, 3) Source(8, 3) + SourceIndex(0)
|
||||
---
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:a.js
|
||||
sourceFile:tests/cases/compiler/b.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>/*--------------------------------------------------------------------------
|
||||
1->
|
||||
2 >^^^^^^^^^^->
|
||||
1->
|
||||
1->Emitted(8, 1) Source(1, 1) + SourceIndex(1)
|
||||
---
|
||||
>>>Copyright
|
||||
>>>---------------------------------------------------------------------------*/
|
||||
1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->/*--------------------------------------------------------------------------
|
||||
>Copyright
|
||||
>---------------------------------------------------------------------------*/
|
||||
1->Emitted(10, 78) Source(3, 78) + SourceIndex(1)
|
||||
---
|
||||
>>>///<reference path="a.ts"/>
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1 >
|
||||
>
|
||||
>///<reference path="a.ts"/>
|
||||
>
|
||||
2 >
|
||||
3 >///<reference path="a.ts"/>
|
||||
1 >Emitted(11, 1) Source(6, 1) + SourceIndex(1)
|
||||
2 >Emitted(11, 1) Source(5, 1) + SourceIndex(1)
|
||||
3 >Emitted(11, 28) Source(5, 28) + SourceIndex(1)
|
||||
---
|
||||
>>>var y = x;
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^
|
||||
4 > ^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > y
|
||||
3 > =
|
||||
4 > x
|
||||
5 > ;
|
||||
1 >Emitted(12, 5) Source(6, 5) + SourceIndex(1)
|
||||
2 >Emitted(12, 6) Source(6, 6) + SourceIndex(1)
|
||||
3 >Emitted(12, 9) Source(6, 9) + SourceIndex(1)
|
||||
4 >Emitted(12, 10) Source(6, 10) + SourceIndex(1)
|
||||
5 >Emitted(12, 11) Source(6, 11) + SourceIndex(1)
|
||||
---
|
||||
>>>//# sourceMappingURL=a.js.map
|
@ -0,0 +1,30 @@
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
/*--------------------------------------------------------------------------
|
||||
Copyright
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
///<reference path="a.ts"/>
|
||||
var y = x;
|
||||
>y : { a: number; b: number; }
|
||||
>x : { a: number; b: number; }
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*--------------------------------------------------------------------------
|
||||
Copyright
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
var x = {
|
||||
>x : { a: number; b: number; }
|
||||
>{
|
||||
a: 10,
|
||||
b: 20
|
||||
} : { a: number; b: number; }
|
||||
|
||||
a: 10,
|
||||
>a : number
|
||||
|
||||
b: 20
|
||||
>b : number
|
||||
|
||||
};
|
||||
|
@ -0,0 +1,19 @@
|
||||
// @out: a.js
|
||||
// @sourcemap: true
|
||||
// @Filename: a.ts
|
||||
/*--------------------------------------------------------------------------
|
||||
Copyright
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
var x = {
|
||||
a: 10,
|
||||
b: 20
|
||||
};
|
||||
|
||||
// @Filename: b.ts
|
||||
/*--------------------------------------------------------------------------
|
||||
Copyright
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
///<reference path="a.ts"/>
|
||||
var y = x;
|
Loading…
x
Reference in New Issue
Block a user