mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-21 15:58:24 -05:00
Preserve newlines appropriately between elements of an object literal or array literal when emitting.
This commit is contained in:
@@ -1930,8 +1930,6 @@ function compile(fileNames, options) {
|
||||
}
|
||||
exports.compile = compile;
|
||||
compile(process.argv.slice(2), {
|
||||
noEmitOnError: true,
|
||||
noImplicitAny: true,
|
||||
target: 1 /* ES5 */,
|
||||
module: 1 /* CommonJS */
|
||||
noEmitOnError: true, noImplicitAny: true,
|
||||
target: 1 /* ES5 */, module: 1 /* CommonJS */
|
||||
});
|
||||
|
||||
@@ -7,5 +7,6 @@ var v = { * foo() {
|
||||
|
||||
//// [YieldExpression10_es6.js]
|
||||
var v = { foo: function () {
|
||||
;
|
||||
} };
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,9 +20,7 @@ var C = (function () {
|
||||
return C;
|
||||
})();
|
||||
var y = {
|
||||
foo: ,
|
||||
class: C2
|
||||
}, _a = void 0;
|
||||
foo: , class: C2 }, _a = void 0;
|
||||
var M;
|
||||
(function (M) {
|
||||
var z = ;
|
||||
|
||||
@@ -150,26 +150,27 @@ var i1Ori2 = {
|
||||
propertyOnlyInI2: "Hello"
|
||||
};
|
||||
var arrayI1OrI2 = [i1, i2, {
|
||||
commonPropertyType: "hello",
|
||||
commonMethodType: function (a) { return a; },
|
||||
commonMethodWithTypeParameter: function (a) { return a; },
|
||||
methodOnlyInI1: function (a) { return a; },
|
||||
propertyOnlyInI1: "Hello"
|
||||
}, {
|
||||
commonPropertyType: "hello",
|
||||
commonMethodType: function (a) { return a; },
|
||||
commonMethodWithTypeParameter: function (a) { return a; },
|
||||
methodOnlyInI2: function (a) { return a; },
|
||||
propertyOnlyInI2: "Hello"
|
||||
}, {
|
||||
commonPropertyType: "hello",
|
||||
commonMethodType: function (a) { return a; },
|
||||
commonMethodWithTypeParameter: function (a) { return a; },
|
||||
methodOnlyInI1: function (a) { return a; },
|
||||
propertyOnlyInI1: "Hello",
|
||||
methodOnlyInI2: function (a) { return a; },
|
||||
propertyOnlyInI2: "Hello"
|
||||
}];
|
||||
commonPropertyType: "hello",
|
||||
commonMethodType: function (a) { return a; },
|
||||
commonMethodWithTypeParameter: function (a) { return a; },
|
||||
methodOnlyInI1: function (a) { return a; },
|
||||
propertyOnlyInI1: "Hello"
|
||||
},
|
||||
{
|
||||
commonPropertyType: "hello",
|
||||
commonMethodType: function (a) { return a; },
|
||||
commonMethodWithTypeParameter: function (a) { return a; },
|
||||
methodOnlyInI2: function (a) { return a; },
|
||||
propertyOnlyInI2: "Hello"
|
||||
}, {
|
||||
commonPropertyType: "hello",
|
||||
commonMethodType: function (a) { return a; },
|
||||
commonMethodWithTypeParameter: function (a) { return a; },
|
||||
methodOnlyInI1: function (a) { return a; },
|
||||
propertyOnlyInI1: "Hello",
|
||||
methodOnlyInI2: function (a) { return a; },
|
||||
propertyOnlyInI2: "Hello"
|
||||
}];
|
||||
var i11;
|
||||
var i21;
|
||||
var i11Ori21 = i11;
|
||||
@@ -191,17 +192,17 @@ var i11Ori21 = {
|
||||
commonPropertyDifferentType: 10
|
||||
};
|
||||
var arrayOrI11OrI21 = [i11, i21, i11 || i21, {
|
||||
// Like i1
|
||||
commonMethodDifferentReturnType: function (a, b) {
|
||||
var z = a.charAt(b);
|
||||
return z;
|
||||
},
|
||||
commonPropertyDifferentType: "hello"
|
||||
}, {
|
||||
// Like i2
|
||||
commonMethodDifferentReturnType: function (a, b) {
|
||||
var z = a.charCodeAt(b);
|
||||
return z;
|
||||
},
|
||||
commonPropertyDifferentType: 10
|
||||
}];
|
||||
// Like i1
|
||||
commonMethodDifferentReturnType: function (a, b) {
|
||||
var z = a.charAt(b);
|
||||
return z;
|
||||
},
|
||||
commonPropertyDifferentType: "hello"
|
||||
}, {
|
||||
// Like i2
|
||||
commonMethodDifferentReturnType: function (a, b) {
|
||||
var z = a.charCodeAt(b);
|
||||
return z;
|
||||
},
|
||||
commonPropertyDifferentType: 10
|
||||
}];
|
||||
|
||||
@@ -150,21 +150,9 @@ var E9;
|
||||
// (refer to .js to validate)
|
||||
// Enum constant members are propagated
|
||||
var doNotPropagate = [
|
||||
E8.B,
|
||||
E7.A,
|
||||
E4.Z,
|
||||
E3.X,
|
||||
E3.Y,
|
||||
E3.Z
|
||||
E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z
|
||||
];
|
||||
// Enum computed members are not propagated
|
||||
var doPropagate = [
|
||||
0 /* A */,
|
||||
E9.B,
|
||||
0 /* B */,
|
||||
1 /* C */,
|
||||
0 /* A */,
|
||||
0 /* A */,
|
||||
3 /* B */,
|
||||
4 /* C */
|
||||
0 /* A */, E9.B, 0 /* B */, 1 /* C */, 0 /* A */, 0 /* A */, 3 /* B */, 4 /* C */
|
||||
];
|
||||
|
||||
@@ -61,5 +61,22 @@ function Foo<
|
||||
|
||||
//// [genericsManyTypeParameters.js]
|
||||
function Foo(x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18) {
|
||||
return [x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18];
|
||||
return [x1, y1, z1, a1, b1, c1,
|
||||
x2, y2, z2, a2, b2, c2,
|
||||
x3, y3, z3, a3, b3, c3,
|
||||
x4, y4, z4, a4, b4, c4,
|
||||
x5, y5, z5, a5, b5, c5,
|
||||
x6, y6, z6, a6, b6, c6,
|
||||
x7, y7, z7, a7, b7, c7,
|
||||
x8, y8, z8, a8, b8, c8,
|
||||
x9, y9, z9, a9, b9, c9,
|
||||
x10, y12, z10, a10, b10, c10,
|
||||
x11, y13, z11, a11, b11, c11,
|
||||
x12, y14, z12, a12, b12, c12,
|
||||
x13, y15, z13, a13, b13, c13,
|
||||
x14, y16, z14, a14, b14, c14,
|
||||
x15, y17, z15, a15, b15, c15,
|
||||
x16, y18, z16, a16, b16, c16,
|
||||
x17, y19, z17, a17, b17, c17,
|
||||
x18, y10, z18, a18, b18, c18];
|
||||
}
|
||||
|
||||
@@ -37,5 +37,4 @@ var C3 = (function () {
|
||||
return C3;
|
||||
})();
|
||||
var x = {
|
||||
class: C4
|
||||
}, _a = void 0;
|
||||
class: C4 }, _a = void 0;
|
||||
|
||||
@@ -5,5 +5,4 @@ var v = {
|
||||
|
||||
//// [objectLiteralWithSemicolons4.js]
|
||||
var v = {
|
||||
a:
|
||||
};
|
||||
a: };
|
||||
|
||||
@@ -42,6 +42,5 @@ var C2 = (function () {
|
||||
return C2;
|
||||
})();
|
||||
var b = {
|
||||
x: function () { },
|
||||
1: // error
|
||||
x: function () { }, 1: // error
|
||||
};
|
||||
|
||||
@@ -3,4 +3,5 @@ var v = [1, 2, 3
|
||||
4, 5, 6, 7];
|
||||
|
||||
//// [parserErrorRecoveryArrayLiteralExpression1.js]
|
||||
var v = [1, 2, 3, 4, 5, 6, 7];
|
||||
var v = [1, 2, 3,
|
||||
4, 5, 6, 7];
|
||||
|
||||
@@ -5,4 +5,5 @@ var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0
|
||||
|
||||
|
||||
//// [parserErrorRecoveryArrayLiteralExpression2.js]
|
||||
var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048];
|
||||
var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0,
|
||||
.7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048];
|
||||
|
||||
@@ -3,4 +3,5 @@ var v = { a
|
||||
return;
|
||||
|
||||
//// [parserErrorRecovery_ObjectLiteral2.js]
|
||||
var v = { a: , return: };
|
||||
var v = { a: ,
|
||||
return: };
|
||||
|
||||
@@ -3,4 +3,5 @@ var v = { a:
|
||||
return;
|
||||
|
||||
//// [parserErrorRecovery_ObjectLiteral3.js]
|
||||
var v = { a: , return: };
|
||||
var v = { a: ,
|
||||
return: };
|
||||
|
||||
@@ -3,4 +3,5 @@ var v = { a: 1
|
||||
return;
|
||||
|
||||
//// [parserErrorRecovery_ObjectLiteral4.js]
|
||||
var v = { a: 1, return: };
|
||||
var v = { a: 1,
|
||||
return: };
|
||||
|
||||
@@ -3,4 +3,5 @@ var v = { a: 1,
|
||||
return;
|
||||
|
||||
//// [parserErrorRecovery_ObjectLiteral5.js]
|
||||
var v = { a: 1, return: };
|
||||
var v = { a: 1,
|
||||
return: };
|
||||
|
||||
@@ -2627,9 +2627,7 @@ var Harness;
|
||||
var description = b.description + (prop ? ": " + prop : '');
|
||||
emitLog('testStart', { desc: description });
|
||||
emitLog('pass', {
|
||||
desc: description,
|
||||
pass: true,
|
||||
perfResults: {
|
||||
desc: description, pass: true, perfResults: {
|
||||
mean: b.results[prop].mean(),
|
||||
min: b.results[prop].min(),
|
||||
max: b.results[prop].max(),
|
||||
|
||||
@@ -12,7 +12,6 @@ var y: {
|
||||
//// [privateIndexer2.js]
|
||||
// private indexers not allowed
|
||||
var x = {
|
||||
[x]: string,
|
||||
string:
|
||||
[x]: string, string:
|
||||
};
|
||||
var y;
|
||||
|
||||
@@ -108,6 +108,9 @@ function C(a, b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
C.prototype = { a: 0, b: 0, C1M1: function (c, d) {
|
||||
return (this.a + c) + (this.b + d);
|
||||
} };
|
||||
C.prototype = { a: 0,
|
||||
b: 0,
|
||||
C1M1: function (c, d) {
|
||||
return (this.a + c) + (this.b + d);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,6 +6,5 @@ var x = {
|
||||
|
||||
//// [templateStringInObjectLiteral.js]
|
||||
var x = {
|
||||
a: "abc" + 123 + "def"
|
||||
} "b";
|
||||
a: "abc" + 123 + "def" } "b";
|
||||
321;
|
||||
|
||||
@@ -6,6 +6,5 @@ var x = {
|
||||
|
||||
//// [templateStringInObjectLiteralES6.js]
|
||||
var x = {
|
||||
a: `abc${123}def`,
|
||||
} `b`;
|
||||
a: `abc${123}def`, } `b`;
|
||||
321;
|
||||
|
||||
@@ -29,8 +29,7 @@ var menuData = [
|
||||
"type": "image",
|
||||
"link": "",
|
||||
"icon": "modules/menu/logo.svg"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "productName",
|
||||
"type": "default",
|
||||
"link": "",
|
||||
|
||||
@@ -9,8 +9,8 @@ var functions = [function () {
|
||||
|
||||
//// [typeCheckingInsideFunctionExpressionInArray.js]
|
||||
var functions = [function () {
|
||||
var k = 10;
|
||||
k = new Object();
|
||||
[1, 2, 3].NonexistantMethod();
|
||||
derp();
|
||||
}];
|
||||
var k = 10;
|
||||
k = new Object();
|
||||
[1, 2, 3].NonexistantMethod();
|
||||
derp();
|
||||
}];
|
||||
|
||||
@@ -11,6 +11,6 @@ var functions = [function() {
|
||||
//// [undefinedSymbolReferencedInArrayLiteral1.js]
|
||||
var tokens = [{ startIndex: deltaOffset }];
|
||||
var functions = [function () {
|
||||
[1, 2, 3].NonexistantMethod();
|
||||
anotherNonExistingMethod();
|
||||
}];
|
||||
[1, 2, 3].NonexistantMethod();
|
||||
anotherNonExistingMethod();
|
||||
}];
|
||||
|
||||
@@ -30,6 +30,6 @@ var C = (function () {
|
||||
})();
|
||||
var c = new C({ length: 2 });
|
||||
var r = c.foo({ length: 3, charAt: function (x) {
|
||||
'';
|
||||
} });
|
||||
'';
|
||||
} });
|
||||
var r2 = r('');
|
||||
|
||||
@@ -28,5 +28,5 @@ var C = (function () {
|
||||
var c = new C({ length: 2 });
|
||||
var r = c.foo('');
|
||||
var r2 = r({ length: 3, charAt: function (x) {
|
||||
'';
|
||||
} }); // error
|
||||
'';
|
||||
} }); // error
|
||||
|
||||
Reference in New Issue
Block a user