Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12596,7 +12596,9 @@ module ts {
else {
let elements = (<BindingPattern>name).elements;
for (let element of elements) {
checkGrammarNameInLetOrConstDeclarations(element.name);
if (element.kind !== SyntaxKind.OmittedExpression) {
checkGrammarNameInLetOrConstDeclarations(element.name);
}
}
}
}
Expand Down
342 changes: 157 additions & 185 deletions src/compiler/emitter.ts

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/server/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ module ts.server {
var info = this.filenameToScriptInfo[args.file];
if (info) {
info.setFormatOptions(args.formatOptions);
this.log("Host configuration update for file " + args.file);
this.log("Host configuration update for file " + args.file, "Info");
}
}
else {
Expand Down Expand Up @@ -823,7 +823,6 @@ module ts.server {
*/

closeClientFile(filename: string) {
// TODO: tsconfig check
var info = ts.lookUp(this.filenameToScriptInfo, filename);
if (info) {
this.closeOpenFile(info);
Expand Down Expand Up @@ -856,6 +855,9 @@ module ts.server {
}

printProjects() {
if (!this.psLogger.isVerbose()) {
return;
}
this.psLogger.startGroup();
for (var i = 0, len = this.inferredProjects.length; i < len; i++) {
var project = this.inferredProjects[i];
Expand Down
7 changes: 7 additions & 0 deletions src/server/protocol.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ declare module ts.server.protocol {
arguments: OpenRequestArgs;
}

/**
* Exit request; value of command field is "exit". Ask the server process
* to exit.
*/
export interface ExitRequest extends Request {
}

/**
* Close request; value of command field is "close". Notify the
* server that the client has closed a previously open file. If
Expand Down
10 changes: 7 additions & 3 deletions src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,20 @@ module ts.server {
super(host, logger);
}

exit() {
this.projectService.log("Exiting...","Info");
this.projectService.closeLog();
process.exit(0);
}

listen() {
rl.on('line',(input: string) => {
var message = input.trim();
this.onMessage(message);
});

rl.on('close',() => {
this.projectService.log("Exiting...");
this.projectService.closeLog();
process.exit(0);
this.exit();
});
}
}
Expand Down
13 changes: 11 additions & 2 deletions src/server/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,14 @@ module ts.server {
}

export module CommandNames {
export var Brace = "brace";
export var Change = "change";
export var Close = "close";
export var Completions = "completions";
export var CompletionDetails = "completionEntryDetails";
export var SignatureHelp = "signatureHelp";
export var Configure = "configure";
export var Definition = "definition";
export var Exit = "exit";
export var Format = "format";
export var Formatonkey = "formatonkey";
export var Geterr = "geterr";
Expand All @@ -94,7 +95,7 @@ module ts.server {
export var Reload = "reload";
export var Rename = "rename";
export var Saveto = "saveto";
export var Brace = "brace";
export var SignatureHelp = "signatureHelp";
export var Unknown = "unknown";
}

Expand Down Expand Up @@ -758,6 +759,9 @@ module ts.server {
}));
}

exit() {
}

onMessage(message: string) {
if (this.logger.isVerbose()) {
this.logger.info("request: " + message);
Expand All @@ -769,6 +773,11 @@ module ts.server {
var errorMessage: string;
var responseRequired = true;
switch (request.command) {
case CommandNames.Exit: {
this.exit();
responseRequired = false;
break;
}
case CommandNames.Definition: {
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
response = this.getDefinition(defArgs.line, defArgs.offset, defArgs.file);
Expand Down
3 changes: 2 additions & 1 deletion tests/baselines/reference/ES5SymbolProperty1.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ obj[Symbol.foo];
var Symbol;
var obj = (_a = {},
_a[Symbol.foo] = 0,
_a);
_a
);
obj[Symbol.foo];
var _a;
4 changes: 1 addition & 3 deletions tests/baselines/reference/FunctionDeclaration8_es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
var v = { [yield]: foo }

//// [FunctionDeclaration8_es6.js]
var v = (_a = {},
_a[yield] = foo,
_a);
var v = (_a = {}, _a[yield] = foo, _a);
var _a;
4 changes: 1 addition & 3 deletions tests/baselines/reference/FunctionDeclaration9_es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ function * foo() {

//// [FunctionDeclaration9_es6.js]
function foo() {
var v = (_a = {},
_a[] = foo,
_a);
var v = (_a = {}, _a[] = foo, _a);
var _a;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
var v = { *[foo()]() { } }

//// [FunctionPropertyAssignments5_es6.js]
var v = (_a = {},
_a[foo()] = function () { },
_a);
var v = (_a = {}, _a[foo()] = function () { }, _a);
var _a;
31 changes: 31 additions & 0 deletions tests/baselines/reference/arrayBindingPatternOmittedExpressions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//// [arrayBindingPatternOmittedExpressions.ts]

var results: string[];

{
let [, b, , a] = results;
let x = {
a,
b
}
}


function f([, a, , b, , , , s, , , ] = results) {
a = s[1];
b = s[2];
}

//// [arrayBindingPatternOmittedExpressions.js]
var results;
{
let [, b, , a] = results;
let x = {
a,
b
};
}
function f([, a, , b, , , , s, , ,] = results) {
a = s[1];
b = s[2];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
=== tests/cases/compiler/arrayBindingPatternOmittedExpressions.ts ===

var results: string[];
>results : string[]

{
let [, b, , a] = results;
>b : string
>a : string
>results : string[]

let x = {
>x : { a: string; b: string; }
>{ a, b } : { a: string; b: string; }

a,
>a : string

b
>b : string
}
}


function f([, a, , b, , , , s, , , ] = results) {
>f : ([, a, , b, , , , s, , , ]?: string[]) => void
>a : string
>b : string
>s : string
>results : string[]

a = s[1];
>a = s[1] : string
>a : string
>s[1] : string
>s : string

b = s[2];
>b = s[2] : string
>b : string
>s[2] : string
>s : string
}
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames10_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ var v = (_a = {},
_a[true] = function () { },
_a["hello bye"] = function () { },
_a["hello " + a + " bye"] = function () { },
_a);
_a
);
var _a;
69 changes: 57 additions & 12 deletions tests/baselines/reference/computedPropertyNames11_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,61 @@ var s;
var n;
var a;
var v = (_a = {},
_a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a);
Object.defineProperty(_a, s, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, n, {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, s + s, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, s + n, {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, +s, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "", {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 0, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, a, {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, true, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "hello bye", {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "hello " + a + " bye", {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
_a
);
var _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames18_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function foo() {
function foo() {
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;
}
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames19_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var M;
(function (M) {
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;
})(M || (M = {}));
16 changes: 13 additions & 3 deletions tests/baselines/reference/computedPropertyNames1_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ var v = {

//// [computedPropertyNames1_ES5.js]
var v = (_a = {},
_a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a);
Object.defineProperty(_a, 0 + 1, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 0 + 1, {
set: function (v) { } //No error
,
enumerable: true,
configurable: true
}),
_a
);
var _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames20_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ var obj = {
//// [computedPropertyNames20_ES5.js]
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames22_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ var C = (function () {
C.prototype.bar = function () {
var obj = (_a = {},
_a[this.bar()] = function () { },
_a);
_a
);
return 0;
var _a;
};
Expand Down
4 changes: 1 addition & 3 deletions tests/baselines/reference/computedPropertyNames23_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ var C = (function () {
C.prototype.bar = function () {
return 0;
};
C.prototype[(_a = {},
_a[this.bar()] = 1,
_a)[0]] = function () { };
C.prototype[(_a = {}, _a[this.bar()] = 1, _a)[0]] = function () { };
return C;
var _a;
})();
3 changes: 2 additions & 1 deletion tests/baselines/reference/computedPropertyNames25_ES5.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ var C = (function (_super) {
C.prototype.foo = function () {
var obj = (_a = {},
_a[_super.prototype.bar.call(this)] = function () { },
_a);
_a
);
return 0;
var _a;
};
Expand Down
Loading