Remove whitespace generation (#5833)
* Remove whitespace generation and rely on default printing Changes to printing: * Add newline after last empty SwitchCase * Add newlines around block comments if they are non-flow comments or contain newlines * Fix a few more fixtures
This commit is contained in:
parent
bc29145465
commit
b3372a572d
@ -3,9 +3,6 @@
|
|||||||
/*
|
/*
|
||||||
Test comment
|
Test comment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
arr.map(function (x) {
|
arr.map(function (x) {
|
||||||
return x * MULTIPLIER;
|
return x * MULTIPLIER;
|
||||||
});
|
}); // END OF FILE
|
||||||
|
|
||||||
// END OF FILE
|
|
||||||
|
|||||||
@ -480,7 +480,7 @@ describe("api", function() {
|
|||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
result.code,
|
result.code,
|
||||||
"/*before*/start;\n/*after*/class Foo {}\n/*before*/end;\n/*after*/",
|
"/*before*/\nstart;\n\n/*after*/\nclass Foo {}\n\n/*before*/\nend;\n\n/*after*/",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,3 +1,2 @@
|
|||||||
export function foo() {}
|
export function foo() {}
|
||||||
|
|
||||||
export function bar() {}
|
export function bar() {}
|
||||||
@ -3,11 +3,12 @@ var Foo = function (_Bar) {
|
|||||||
|
|
||||||
function Foo(options) {
|
function Foo(options) {
|
||||||
babelHelpers.classCallCheck(this, Foo);
|
babelHelpers.classCallCheck(this, Foo);
|
||||||
|
|
||||||
var parentOptions = {};
|
var parentOptions = {};
|
||||||
|
|
||||||
parentOptions.init = function () {
|
parentOptions.init = function () {
|
||||||
this;
|
this;
|
||||||
};
|
};
|
||||||
|
|
||||||
return babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this, parentOptions));
|
return babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this, parentOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
function test() {
|
function test() {
|
||||||
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "hi";
|
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "hi";
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
@ -10,7 +10,9 @@ function f() {
|
|||||||
return _ref.apply(this, arguments);
|
return _ref.apply(this, arguments);
|
||||||
};
|
};
|
||||||
}();
|
}();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
class Class {
|
class Class {
|
||||||
m() {
|
m() {
|
||||||
@ -28,4 +30,5 @@ class Class {
|
|||||||
}();
|
}();
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3,5 +3,4 @@
|
|||||||
var _values = values;
|
var _values = values;
|
||||||
value = _values[fieldName];
|
value = _values[fieldName];
|
||||||
rest = babelHelpers.objectWithoutProperties(_values, [fieldName]);
|
rest = babelHelpers.objectWithoutProperties(_values, [fieldName]);
|
||||||
|
|
||||||
var error = void 0;
|
var error = void 0;
|
||||||
@ -1,4 +1,2 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
|
||||||
foobar();
|
foobar();
|
||||||
@ -329,7 +329,11 @@ export function ObjectTypeAnnotation(node: Object) {
|
|||||||
this.token("{");
|
this.token("{");
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = node.properties.concat(node.callProperties, node.indexers);
|
// TODO: remove the array fallbacks and instead enforce the types to require an array
|
||||||
|
const props = node.properties.concat(
|
||||||
|
node.callProperties || [],
|
||||||
|
node.indexers || [],
|
||||||
|
);
|
||||||
|
|
||||||
if (props.length) {
|
if (props.length) {
|
||||||
this.space();
|
this.space();
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import SourceMap from "./source-map";
|
import SourceMap from "./source-map";
|
||||||
import * as messages from "babel-messages";
|
import * as messages from "babel-messages";
|
||||||
import Printer from "./printer";
|
import Printer, { type Format } from "./printer";
|
||||||
import type { Format } from "./printer";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Babel's code generator, turns an ast into code, maintaining sourcemaps,
|
* Babel's code generator, turns an ast into code, maintaining sourcemaps,
|
||||||
@ -10,10 +9,9 @@ import type { Format } from "./printer";
|
|||||||
|
|
||||||
class Generator extends Printer {
|
class Generator extends Printer {
|
||||||
constructor(ast, opts = {}, code) {
|
constructor(ast, opts = {}, code) {
|
||||||
const tokens = ast.tokens || [];
|
|
||||||
const format = normalizeOptions(code, opts);
|
const format = normalizeOptions(code, opts);
|
||||||
const map = opts.sourceMaps ? new SourceMap(opts, code) : null;
|
const map = opts.sourceMaps ? new SourceMap(opts, code) : null;
|
||||||
super(format, map, tokens);
|
super(format, map);
|
||||||
|
|
||||||
this.ast = ast;
|
this.ast = ast;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,9 +86,12 @@ export const nodes = {
|
|||||||
* Test if SwitchCase needs whitespace.
|
* Test if SwitchCase needs whitespace.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SwitchCase(node: Object, parent: Object): ?WhitespaceObject {
|
SwitchCase(node: Object, parent: Object): WhitespaceObject {
|
||||||
return {
|
return {
|
||||||
before: node.consequent.length || parent.cases[0] === node,
|
before: node.consequent.length || parent.cases[0] === node,
|
||||||
|
after:
|
||||||
|
!node.consequent.length &&
|
||||||
|
parent.cases[parent.cases.length - 1] === node,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -181,6 +184,32 @@ nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nodes.ObjectTypeCallProperty = function(
|
||||||
|
node: Object,
|
||||||
|
parent,
|
||||||
|
): ?WhitespaceObject {
|
||||||
|
if (
|
||||||
|
parent.callProperties[0] === node &&
|
||||||
|
(!parent.properties || !parent.properties.length)
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
before: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.ObjectTypeIndexer = function(node: Object, parent): ?WhitespaceObject {
|
||||||
|
if (
|
||||||
|
parent.indexers[0] === node &&
|
||||||
|
(!parent.properties || !parent.properties.length) &&
|
||||||
|
(!parent.callProperties || !parent.callProperties.length)
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
before: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns lists from node types that need whitespace.
|
* Returns lists from node types that need whitespace.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,10 +1,7 @@
|
|||||||
import find from "lodash/find";
|
|
||||||
import findLast from "lodash/findLast";
|
|
||||||
import isInteger from "lodash/isInteger";
|
import isInteger from "lodash/isInteger";
|
||||||
import repeat from "lodash/repeat";
|
import repeat from "lodash/repeat";
|
||||||
import Buffer from "./buffer";
|
import Buffer from "./buffer";
|
||||||
import * as n from "./node";
|
import * as n from "./node";
|
||||||
import Whitespace from "./whitespace";
|
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
import * as generatorFunctions from "./generators";
|
import * as generatorFunctions from "./generators";
|
||||||
@ -32,17 +29,15 @@ export type Format = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default class Printer {
|
export default class Printer {
|
||||||
constructor(format, map, tokens) {
|
constructor(format, map) {
|
||||||
this.format = format || {};
|
this.format = format || {};
|
||||||
this._buf = new Buffer(map);
|
this._buf = new Buffer(map);
|
||||||
this._whitespace = tokens.length > 0 ? new Whitespace(tokens) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
format: Format;
|
format: Format;
|
||||||
inForStatementInitCounter: number = 0;
|
inForStatementInitCounter: number = 0;
|
||||||
|
|
||||||
_buf: Buffer;
|
_buf: Buffer;
|
||||||
_whitespace: Whitespace;
|
|
||||||
_printStack: Array<Node> = [];
|
_printStack: Array<Node> = [];
|
||||||
_indent: number = 0;
|
_indent: number = 0;
|
||||||
_insideAux: boolean = false;
|
_insideAux: boolean = false;
|
||||||
@ -498,43 +493,13 @@ export default class Printer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let lines = 0;
|
let lines = 0;
|
||||||
|
// don't add newlines at the beginning of the file
|
||||||
if (node.start != null && !node._ignoreUserWhitespace && this._whitespace) {
|
if (this._buf.hasContent()) {
|
||||||
// user node
|
|
||||||
if (leading) {
|
|
||||||
const comments = node.leadingComments;
|
|
||||||
const comment =
|
|
||||||
comments &&
|
|
||||||
find(
|
|
||||||
comments,
|
|
||||||
comment =>
|
|
||||||
!!comment.loc && this.format.shouldPrintComment(comment.value),
|
|
||||||
);
|
|
||||||
|
|
||||||
lines = this._whitespace.getNewlinesBefore(comment || node);
|
|
||||||
} else {
|
|
||||||
const comments = node.trailingComments;
|
|
||||||
const comment =
|
|
||||||
comments &&
|
|
||||||
findLast(
|
|
||||||
comments,
|
|
||||||
comment =>
|
|
||||||
!!comment.loc && this.format.shouldPrintComment(comment.value),
|
|
||||||
);
|
|
||||||
|
|
||||||
lines = this._whitespace.getNewlinesAfter(comment || node);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// generated node
|
|
||||||
if (!leading) lines++; // always include at least a single line after
|
if (!leading) lines++; // always include at least a single line after
|
||||||
if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0;
|
if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0;
|
||||||
|
|
||||||
let needs = n.needsWhitespaceAfter;
|
const needs = leading ? n.needsWhitespaceBefore : n.needsWhitespaceAfter;
|
||||||
if (leading) needs = n.needsWhitespaceBefore;
|
|
||||||
if (needs(node, parent)) lines++;
|
if (needs(node, parent)) lines++;
|
||||||
|
|
||||||
// generated nodes can't add starting file whitespace
|
|
||||||
if (!this._buf.hasContent()) lines = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.newline(lines);
|
this.newline(lines);
|
||||||
@ -563,23 +528,17 @@ export default class Printer {
|
|||||||
this._printedCommentStarts[comment.start] = true;
|
this._printedCommentStarts[comment.start] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// whitespace before
|
const isBlockComment = comment.type === "CommentBlock";
|
||||||
this.newline(
|
|
||||||
this._whitespace ? this._whitespace.getNewlinesBefore(comment) : 0,
|
// Always add a newline before a block comment
|
||||||
);
|
this.newline(this._buf.hasContent() && isBlockComment ? 1 : 0);
|
||||||
|
|
||||||
if (!this.endsWith("[") && !this.endsWith("{")) this.space();
|
if (!this.endsWith("[") && !this.endsWith("{")) this.space();
|
||||||
|
|
||||||
let val =
|
let val = !isBlockComment ? `//${comment.value}\n` : `/*${comment.value}*/`;
|
||||||
comment.type === "CommentLine"
|
|
||||||
? `//${comment.value}\n`
|
|
||||||
: `/*${comment.value}*/`;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
if (
|
if (isBlockComment && this.format.indent.adjustMultilineComment) {
|
||||||
comment.type === "CommentBlock" &&
|
|
||||||
this.format.indent.adjustMultilineComment
|
|
||||||
) {
|
|
||||||
const offset = comment.loc && comment.loc.start.column;
|
const offset = comment.loc && comment.loc.start.column;
|
||||||
if (offset) {
|
if (offset) {
|
||||||
const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
|
const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
|
||||||
@ -600,12 +559,8 @@ export default class Printer {
|
|||||||
this._append(val);
|
this._append(val);
|
||||||
});
|
});
|
||||||
|
|
||||||
// whitespace after
|
// Always add a newline after a block comment
|
||||||
this.newline(
|
this.newline(isBlockComment ? 1 : 0);
|
||||||
(this._whitespace ? this._whitespace.getNewlinesAfter(comment) : 0) +
|
|
||||||
// Subtract one to account for the line force-added above.
|
|
||||||
(comment.type === "CommentLine" ? -1 : 0),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_printComments(comments?: Array<Object>) {
|
_printComments(comments?: Array<Object>) {
|
||||||
|
|||||||
@ -1,100 +0,0 @@
|
|||||||
/**
|
|
||||||
* Get whitespace around tokens.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class Whitespace {
|
|
||||||
constructor(tokens) {
|
|
||||||
this.tokens = tokens;
|
|
||||||
this.used = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Count all the newlines before a node.
|
|
||||||
*/
|
|
||||||
|
|
||||||
getNewlinesBefore(node) {
|
|
||||||
let startToken;
|
|
||||||
let endToken;
|
|
||||||
const tokens = this.tokens;
|
|
||||||
|
|
||||||
let index = this._findToken(
|
|
||||||
token => token.start - node.start,
|
|
||||||
0,
|
|
||||||
tokens.length,
|
|
||||||
);
|
|
||||||
if (index >= 0) {
|
|
||||||
while (index && node.start === tokens[index - 1].start) --index;
|
|
||||||
startToken = tokens[index - 1];
|
|
||||||
endToken = tokens[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._getNewlinesBetween(startToken, endToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Count all the newlines after a node.
|
|
||||||
*/
|
|
||||||
|
|
||||||
getNewlinesAfter(node) {
|
|
||||||
let startToken;
|
|
||||||
let endToken;
|
|
||||||
const tokens = this.tokens;
|
|
||||||
|
|
||||||
let index = this._findToken(
|
|
||||||
token => token.end - node.end,
|
|
||||||
0,
|
|
||||||
tokens.length,
|
|
||||||
);
|
|
||||||
if (index >= 0) {
|
|
||||||
while (index && node.end === tokens[index - 1].end) --index;
|
|
||||||
startToken = tokens[index];
|
|
||||||
endToken = tokens[index + 1];
|
|
||||||
if (endToken.type.label === ",") endToken = tokens[index + 2];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endToken && endToken.type.label === "eof") {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return this._getNewlinesBetween(startToken, endToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Count all the newlines between two tokens.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_getNewlinesBetween(startToken, endToken) {
|
|
||||||
if (!endToken || !endToken.loc) return 0;
|
|
||||||
|
|
||||||
const start = startToken ? startToken.loc.end.line : 1;
|
|
||||||
const end = endToken.loc.start.line;
|
|
||||||
let lines = 0;
|
|
||||||
|
|
||||||
for (let line = start; line < end; line++) {
|
|
||||||
if (typeof this.used[line] === "undefined") {
|
|
||||||
this.used[line] = true;
|
|
||||||
lines++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return lines;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find a token between start and end.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_findToken(test: Function, start: number, end: number): number {
|
|
||||||
if (start >= end) return -1;
|
|
||||||
const middle = (start + end) >>> 1;
|
|
||||||
const match: number = test(this.tokens[middle]);
|
|
||||||
if (match < 0) {
|
|
||||||
return this._findToken(test, middle + 1, end);
|
|
||||||
} else if (match > 0) {
|
|
||||||
return this._findToken(test, start, middle);
|
|
||||||
} else if (match === 0) {
|
|
||||||
return middle;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
function foo() {
|
function foo() {
|
||||||
bar();
|
bar();
|
||||||
|
|
||||||
if (foo) {
|
if (foo) {
|
||||||
bar();
|
bar();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
function foo() {
|
function foo() {
|
||||||
bar();
|
bar();
|
||||||
|
|
||||||
if (foo) {
|
if (foo) {
|
||||||
bar();
|
bar();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
function foo() {
|
function foo() {
|
||||||
bar();
|
bar();
|
||||||
|
|
||||||
if (foo) {
|
if (foo) {
|
||||||
bar();
|
bar();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
var single = 'quotes';
|
var single = 'quotes';
|
||||||
var outnumber = 'double';
|
var outnumber = 'double';
|
||||||
var moreSingleQuotesThanDouble = '!';
|
var moreSingleQuotesThanDouble = '!';
|
||||||
|
|
||||||
React.createClass({
|
React.createClass({
|
||||||
render() {
|
render() {
|
||||||
return <View multiple="attributes" attribute="If parent is JSX keep double quote" />;
|
return <View multiple="attributes" attribute="If parent is JSX keep double quote" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -1,8 +1,6 @@
|
|||||||
function test() {
|
function test() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this is comment
|
* this is comment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var i = 20;
|
var i = 20;
|
||||||
}
|
}
|
||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// from #23
|
// from #23
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// from #23
|
// from #23
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
@ -3,9 +3,10 @@ var test = {
|
|||||||
* Before bracket init
|
* Before bracket init
|
||||||
*/
|
*/
|
||||||
["a"]: "1",
|
["a"]: "1",
|
||||||
[/*
|
[
|
||||||
* Inside bracket init
|
/*
|
||||||
*/
|
* Inside bracket init
|
||||||
|
*/
|
||||||
"b"]: "2"
|
"b"]: "2"
|
||||||
},
|
},
|
||||||
ok = 42;
|
ok = 42;
|
||||||
@ -3,25 +3,20 @@ var test = {
|
|||||||
* Before bracket init
|
* Before bracket init
|
||||||
*/
|
*/
|
||||||
["a"]: "1",
|
["a"]: "1",
|
||||||
|
[
|
||||||
[/*
|
/*
|
||||||
* Inside bracket init
|
* Inside bracket init
|
||||||
*/
|
*/
|
||||||
"b"]: "2",
|
"b"]: "2",
|
||||||
|
|
||||||
["c"
|
["c"
|
||||||
/*
|
/*
|
||||||
* After bracket key
|
* After bracket key
|
||||||
*/]: "3",
|
*/
|
||||||
|
]: "3",
|
||||||
// Before bracket, line comment
|
// Before bracket, line comment
|
||||||
["d"]: "4",
|
["d"]: "4",
|
||||||
|
[// Inside bracket, line comment
|
||||||
[
|
|
||||||
// Inside bracket, line comment
|
|
||||||
"e"]: "5",
|
"e"]: "5",
|
||||||
|
["f" // After bracket, line comment
|
||||||
["f"
|
|
||||||
// After bracket, line comment
|
|
||||||
]: "6"
|
]: "6"
|
||||||
};
|
};
|
||||||
@ -1,6 +1,11 @@
|
|||||||
!function () {} //
|
!function () {} //
|
||||||
, 42;
|
, 42;
|
||||||
!{ get 42() {} //
|
!{
|
||||||
, foo: 42 };
|
get 42() {} //
|
||||||
|
,
|
||||||
|
|
||||||
|
foo: 42
|
||||||
|
};
|
||||||
|
|
||||||
(function () {} //
|
(function () {} //
|
||||||
);
|
);
|
||||||
@ -1,5 +1,4 @@
|
|||||||
if (cond)
|
if (cond) // Leading to if-block
|
||||||
// Leading to if-block
|
|
||||||
{
|
{
|
||||||
print("hello");
|
print("hello");
|
||||||
} // Trailing to if-block
|
} // Trailing to if-block
|
||||||
@ -1,3 +1,2 @@
|
|||||||
if (cond)
|
if (cond) // Leading to EmptyStatement
|
||||||
// Leading to EmptyStatement
|
|
||||||
; // Trailing to EmptyStatement
|
; // Trailing to EmptyStatement
|
||||||
@ -2,6 +2,6 @@ function test() {
|
|||||||
// Leading if statement
|
// Leading if statement
|
||||||
if (cond) {
|
if (cond) {
|
||||||
print("hello");
|
print("hello");
|
||||||
}
|
} // Trailing if-block statement
|
||||||
// Trailing if-block statement
|
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@ var test = {
|
|||||||
* Test 2
|
* Test 2
|
||||||
*/
|
*/
|
||||||
a: "1",
|
a: "1",
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test 1
|
* Test 1
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -19,11 +19,7 @@
|
|||||||
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
function test() {} // Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||||
|
|
||||||
function test() {}
|
|
||||||
|
|
||||||
// Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@ -21,9 +21,7 @@
|
|||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function test() {}
|
function test() {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,2 @@
|
|||||||
// Leading
|
// Leading
|
||||||
var i = 20;
|
var i = 20; // Trailing
|
||||||
// Trailing
|
|
||||||
@ -8,7 +8,6 @@ function test() {
|
|||||||
* Leading comment 2
|
* Leading comment 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var i = 20;
|
var i = 20;
|
||||||
/*
|
/*
|
||||||
* Trailing comment
|
* Trailing comment
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
function test() {
|
function test() {
|
||||||
var
|
var // Leading to VariableDeclarator
|
||||||
// Leading to VariableDeclarator
|
|
||||||
// Leading to VariableDeclarator
|
// Leading to VariableDeclarator
|
||||||
i = 20,
|
i = 20,
|
||||||
|
// Leading to VariableDeclarator
|
||||||
// Leading to VariableDeclarator
|
|
||||||
// Leading to VariableDeclarator
|
// Leading to VariableDeclarator
|
||||||
j = 20;
|
j = 20;
|
||||||
}
|
}
|
||||||
@ -1,18 +1,20 @@
|
|||||||
{
|
{
|
||||||
var t = 20; /*
|
var t = 20;
|
||||||
* This is trailing comment
|
/*
|
||||||
*/
|
* This is trailing comment
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
var tt = 20; /*
|
var tt = 20;
|
||||||
* This is trailing comment
|
/*
|
||||||
*/
|
* This is trailing comment
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
var t = 20; /*
|
var t = 20;
|
||||||
* This is trailing comment
|
/*
|
||||||
*/
|
* This is trailing comment
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5,8 +5,13 @@
|
|||||||
//for (var i = 10 + (10 in []) in []);
|
//for (var i = 10 + (10 in []) in []);
|
||||||
//for (var i = 10 + 10 in [] in []);
|
//for (var i = 10 + 10 in [] in []);
|
||||||
for (var i = (1 in []);;);
|
for (var i = (1 in []);;);
|
||||||
|
|
||||||
for ((1 in []);;);
|
for ((1 in []);;);
|
||||||
|
|
||||||
for (1 * (1 in []);;);
|
for (1 * (1 in []);;);
|
||||||
|
|
||||||
for (1 * (1 + 1 in []);;);
|
for (1 * (1 + 1 in []);;);
|
||||||
|
|
||||||
for (1 * (1 + 1 in []);;);
|
for (1 * (1 + 1 in []);;);
|
||||||
|
|
||||||
for (1 * (1 + (1 in []));;);
|
for (1 * (1 + (1 in []));;);
|
||||||
@ -1,4 +1,5 @@
|
|||||||
for ((a in b) ? a : b; i;);
|
for ((a in b) ? a : b; i;);
|
||||||
|
|
||||||
for (function () {
|
for (function () {
|
||||||
for (;;);
|
for (;;);
|
||||||
} && (a in b);;);
|
} && (a in b);;);
|
||||||
@ -1,7 +1,13 @@
|
|||||||
const bar1 = (x: number): string => {};
|
const bar1 = (x: number): string => {};
|
||||||
|
|
||||||
const bar2 = (x?) => {};
|
const bar2 = (x?) => {};
|
||||||
|
|
||||||
const bar3 = (x?: string) => {};
|
const bar3 = (x?: string) => {};
|
||||||
|
|
||||||
const bar4 = x => {};
|
const bar4 = x => {};
|
||||||
|
|
||||||
const bar5 = (x): string => {};
|
const bar5 = (x): string => {};
|
||||||
|
|
||||||
const bar6 = (x: number) => {};
|
const bar6 = (x: number) => {};
|
||||||
|
|
||||||
const bar7 = <T>(x) => {};
|
const bar7 = <T>(x) => {};
|
||||||
@ -1,5 +1,18 @@
|
|||||||
var a: { (): number };
|
var a: {
|
||||||
var a: { (): number };
|
(): number
|
||||||
var a: { y: string, (): number, (x: string): string, };
|
};
|
||||||
var a: { <T>(x: T): number };
|
var a: {
|
||||||
interface A { (): number };
|
(): number
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
y: string,
|
||||||
|
(): number,
|
||||||
|
(x: string): string,
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
<T>(x: T): number
|
||||||
|
};
|
||||||
|
interface A {
|
||||||
|
(): number
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|||||||
@ -5,10 +5,19 @@ declare export function foo(): void;
|
|||||||
declare export function foo<T>(): void;
|
declare export function foo<T>(): void;
|
||||||
declare export function foo(x: number, y: string): void;
|
declare export function foo(x: number, y: string): void;
|
||||||
declare export class A {}
|
declare export class A {}
|
||||||
declare export class A<T> extends B<T> { x: number }
|
declare export class A<T> extends B<T> {
|
||||||
declare export class A { static foo: () => number, static x: string, }
|
x: number
|
||||||
declare export class A { static [indexer: number]: string }
|
}
|
||||||
declare export class A { static (): number }
|
declare export class A {
|
||||||
|
static foo: () => number,
|
||||||
|
static x: string,
|
||||||
|
}
|
||||||
|
declare export class A {
|
||||||
|
static [indexer: number]: string
|
||||||
|
}
|
||||||
|
declare export class A {
|
||||||
|
static (): number
|
||||||
|
}
|
||||||
declare export class A mixins B<T>, C {}
|
declare export class A mixins B<T>, C {}
|
||||||
declare export default class A {}
|
declare export default class A {}
|
||||||
declare export default function foo(): void;
|
declare export default function foo(): void;
|
||||||
@ -17,7 +26,6 @@ declare export * from 'asd';
|
|||||||
declare export { a, b };
|
declare export { a, b };
|
||||||
declare export {};
|
declare export {};
|
||||||
declare export { c, d } from 'bar';
|
declare export { c, d } from 'bar';
|
||||||
|
|
||||||
declare module B {
|
declare module B {
|
||||||
declare export type B = {};
|
declare export type B = {};
|
||||||
declare export interface Moon {}
|
declare export interface Moon {}
|
||||||
|
|||||||
@ -7,8 +7,12 @@ declare module A {
|
|||||||
declare function foo(): number;
|
declare function foo(): number;
|
||||||
}
|
}
|
||||||
declare module A {
|
declare module A {
|
||||||
declare class B { foo: () => number }
|
declare class B {
|
||||||
|
foo: () => number
|
||||||
|
}
|
||||||
}
|
}
|
||||||
declare module A {
|
declare module A {
|
||||||
declare module.exports: { foo: () => number }
|
declare module.exports: {
|
||||||
|
foo: () => number
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -5,17 +5,36 @@ declare function foo(): void;
|
|||||||
declare function foo<T>(): void;
|
declare function foo<T>(): void;
|
||||||
declare function foo(x: number, y: string): void;
|
declare function foo(x: number, y: string): void;
|
||||||
declare class A {}
|
declare class A {}
|
||||||
declare class A<T> extends B<T> { x: number }
|
declare class A<T> extends B<T> {
|
||||||
declare class A { static foo: () => number, static x: string, }
|
x: number
|
||||||
declare class A { static [indexer: number]: string }
|
}
|
||||||
declare class A { static (): number }
|
declare class A {
|
||||||
declare class B { (): number }
|
static foo: () => number,
|
||||||
|
static x: string,
|
||||||
|
}
|
||||||
|
declare class A {
|
||||||
|
static [indexer: number]: string
|
||||||
|
}
|
||||||
|
declare class A {
|
||||||
|
static (): number
|
||||||
|
}
|
||||||
|
declare class B {
|
||||||
|
(): number
|
||||||
|
}
|
||||||
declare class A mixins B<T>, C {}
|
declare class A mixins B<T>, C {}
|
||||||
declare type A = string;
|
declare type A = string;
|
||||||
declare type T<U> = { [k: string]: U };
|
declare type T<U> = {
|
||||||
|
[k: string]: U
|
||||||
|
};
|
||||||
declare type B = {
|
declare type B = {
|
||||||
fn?: (foo: string) => void
|
fn?: (foo: string) => void
|
||||||
};
|
};
|
||||||
declare interface I { foo: string }
|
declare interface I {
|
||||||
declare interface I<T> { foo: T }
|
foo: string
|
||||||
declare module.exports: { foo: string }
|
}
|
||||||
|
declare interface I<T> {
|
||||||
|
foo: T
|
||||||
|
}
|
||||||
|
declare module.exports: {
|
||||||
|
foo: string
|
||||||
|
}
|
||||||
|
|||||||
@ -1,21 +1,61 @@
|
|||||||
class C1<+T, -U> {}
|
class C1<+T, -U> {}
|
||||||
|
|
||||||
function f<+T, -U>() {}
|
function f<+T, -U>() {}
|
||||||
|
|
||||||
type T<+T, -U> = {};
|
type T<+T, -U> = {};
|
||||||
type T = { +p: T };
|
type T = {
|
||||||
type T = { -p: T };
|
+p: T
|
||||||
type T = { +[k: K]: V };
|
};
|
||||||
type T = { -[k: K]: V };
|
type T = {
|
||||||
interface I { +p: T };
|
-p: T
|
||||||
interface I { -p: T };
|
};
|
||||||
interface I { +[k: K]: V };
|
type T = {
|
||||||
interface I { -[k: K]: V };
|
+[k: K]: V
|
||||||
declare class I { +p: T };
|
};
|
||||||
declare class I { -p: T };
|
type T = {
|
||||||
declare class I { +[k: K]: V };
|
-[k: K]: V
|
||||||
declare class I { -[k: K]: V };
|
};
|
||||||
|
interface I {
|
||||||
|
+p: T
|
||||||
|
}
|
||||||
|
;
|
||||||
|
interface I {
|
||||||
|
-p: T
|
||||||
|
}
|
||||||
|
;
|
||||||
|
interface I {
|
||||||
|
+[k: K]: V
|
||||||
|
}
|
||||||
|
;
|
||||||
|
interface I {
|
||||||
|
-[k: K]: V
|
||||||
|
}
|
||||||
|
;
|
||||||
|
declare class I {
|
||||||
|
+p: T
|
||||||
|
}
|
||||||
|
;
|
||||||
|
declare class I {
|
||||||
|
-p: T
|
||||||
|
}
|
||||||
|
;
|
||||||
|
declare class I {
|
||||||
|
+[k: K]: V
|
||||||
|
}
|
||||||
|
;
|
||||||
|
declare class I {
|
||||||
|
-[k: K]: V
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
class C2 {
|
class C2 {
|
||||||
+p: T = e;
|
+p: T = e;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
class C3 {
|
class C3 {
|
||||||
-p: T = e;
|
-p: T = e;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|||||||
@ -1,9 +1,23 @@
|
|||||||
interface A {};
|
interface A {}
|
||||||
interface A extends B {};
|
;
|
||||||
interface A<T> extends B<T>, C<T> {};
|
interface A extends B {}
|
||||||
interface A { foo: () => number };
|
;
|
||||||
interface Dictionary { length: number, [index: string]: string, };
|
interface A<T> extends B<T>, C<T> {}
|
||||||
|
;
|
||||||
|
interface A {
|
||||||
|
foo: () => number
|
||||||
|
}
|
||||||
|
;
|
||||||
|
interface Dictionary {
|
||||||
|
length: number,
|
||||||
|
[index: string]: string,
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
class Foo implements Bar {}
|
class Foo implements Bar {}
|
||||||
|
|
||||||
class Foo extends Bar implements Bat, Man<number> {}
|
class Foo extends Bar implements Bat, Man<number> {}
|
||||||
|
|
||||||
class Foo extends class Bar implements Bat {} {}
|
class Foo extends class Bar implements Bat {} {}
|
||||||
|
|
||||||
class Foo extends class Bar implements Bat {} implements Man {}
|
class Foo extends class Bar implements Bat {} implements Man {}
|
||||||
@ -1,7 +1,18 @@
|
|||||||
type U = {};
|
type U = {};
|
||||||
type V = {};
|
type V = {};
|
||||||
type T = { ...U };
|
type T = { ...U
|
||||||
type T = { ...U, ...V, };
|
};
|
||||||
type T = { p: V, ...U, };
|
type T = { ...U,
|
||||||
type T = { ...U, p: V, };
|
...V,
|
||||||
type T = { ...{} | { p: V } };
|
};
|
||||||
|
type T = {
|
||||||
|
p: V,
|
||||||
|
...U,
|
||||||
|
};
|
||||||
|
type T = { ...U,
|
||||||
|
p: V,
|
||||||
|
};
|
||||||
|
type T = { ...{} | {
|
||||||
|
p: V
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -1,2 +1,3 @@
|
|||||||
function createElement(tagName: "div"): HTMLDivElement {}
|
function createElement(tagName: "div"): HTMLDivElement {}
|
||||||
|
|
||||||
function createElement(tagName: 'div'): HTMLDivElement {}
|
function createElement(tagName: 'div'): HTMLDivElement {}
|
||||||
@ -2,4 +2,5 @@ class Foo {
|
|||||||
bar(): this {
|
bar(): this {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2,7 +2,9 @@ type FBID = number;
|
|||||||
type Foo<T> = Bar<T>;
|
type Foo<T> = Bar<T>;
|
||||||
type Maybe<T> = _Maybe<T, *>;
|
type Maybe<T> = _Maybe<T, *>;
|
||||||
export type Foo = number;
|
export type Foo = number;
|
||||||
|
type union = {
|
||||||
type union = { type: "A" } | { type: "B" };
|
type: "A"
|
||||||
|
} | {
|
||||||
|
type: "B"
|
||||||
|
};
|
||||||
type overloads = (x: string) => number & (x: number) => string;
|
type overloads = (x: string) => number & (x: number) => string;
|
||||||
@ -1,94 +1,213 @@
|
|||||||
function foo(numVal: any) {}
|
function foo(numVal: any) {}
|
||||||
|
|
||||||
function foo(numVal: number) {}
|
function foo(numVal: number) {}
|
||||||
|
|
||||||
function foo(numVal: number, strVal: string) {}
|
function foo(numVal: number, strVal: string) {}
|
||||||
|
|
||||||
function foo(numVal: number, untypedVal) {}
|
function foo(numVal: number, untypedVal) {}
|
||||||
|
|
||||||
function foo(untypedVal, numVal: number) {}
|
function foo(untypedVal, numVal: number) {}
|
||||||
|
|
||||||
function foo(nullableNum: ?number) {}
|
function foo(nullableNum: ?number) {}
|
||||||
|
|
||||||
function foo(callback: () => void) {}
|
function foo(callback: () => void) {}
|
||||||
|
|
||||||
function foo(callback: () => number) {}
|
function foo(callback: () => number) {}
|
||||||
|
|
||||||
function foo(callback: (_: boolean) => number) {}
|
function foo(callback: (_: boolean) => number) {}
|
||||||
|
|
||||||
function foo(callback: (_1: boolean, _2: string) => number) {}
|
function foo(callback: (_1: boolean, _2: string) => number) {}
|
||||||
|
|
||||||
function foo(callback: (_1: boolean, ...foo: Array<number>) => number) {}
|
function foo(callback: (_1: boolean, ...foo: Array<number>) => number) {}
|
||||||
|
|
||||||
function foo(): number {}
|
function foo(): number {}
|
||||||
|
|
||||||
function foo(): () => void {}
|
function foo(): () => void {}
|
||||||
|
|
||||||
function foo(): (_: boolean) => number {}
|
function foo(): (_: boolean) => number {}
|
||||||
|
|
||||||
function foo(): (_?: boolean) => number {}
|
function foo(): (_?: boolean) => number {}
|
||||||
|
|
||||||
function foo(): {} {}
|
function foo(): {} {}
|
||||||
|
|
||||||
function foo<T>() {}
|
function foo<T>() {}
|
||||||
|
|
||||||
function foo<T, S>() {}
|
function foo<T, S>() {}
|
||||||
|
|
||||||
function foo<T: F>() {}
|
function foo<T: F>() {}
|
||||||
|
|
||||||
a = function <T, S>() {};
|
a = function <T, S>() {};
|
||||||
a = { set fooProp(value: number) {} };
|
|
||||||
a = { set fooProp(value: number): void {} };
|
a = {
|
||||||
a = { get fooProp(): number {} };
|
set fooProp(value: number) {}
|
||||||
a = { id<T>(x: T): T {} };
|
|
||||||
a = { *id<T>(x: T): T {} };
|
};
|
||||||
a = { async id<T>(x: T): T {} };
|
a = {
|
||||||
a = { 123<T>(x: T): T {} };
|
set fooProp(value: number): void {}
|
||||||
|
|
||||||
|
};
|
||||||
|
a = {
|
||||||
|
get fooProp(): number {}
|
||||||
|
|
||||||
|
};
|
||||||
|
a = {
|
||||||
|
id<T>(x: T): T {}
|
||||||
|
|
||||||
|
};
|
||||||
|
a = {
|
||||||
|
*id<T>(x: T): T {}
|
||||||
|
|
||||||
|
};
|
||||||
|
a = {
|
||||||
|
async id<T>(x: T): T {}
|
||||||
|
|
||||||
|
};
|
||||||
|
a = {
|
||||||
|
123<T>(x: T): T {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
set fooProp(value: number) {}
|
set fooProp(value: number) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
set fooProp(value: number): void {}
|
set fooProp(value: number): void {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
get fooProp(): number {}
|
get fooProp(): number {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var numVal: number;
|
var numVal: number;
|
||||||
var numVal: empty;
|
var numVal: empty;
|
||||||
var numVal: mixed;
|
var numVal: mixed;
|
||||||
var numVal: number = otherNumVal;
|
var numVal: number = otherNumVal;
|
||||||
var a: { numVal: number };
|
var a: {
|
||||||
var a: { numVal: number };
|
numVal: number
|
||||||
var a: { numVal: number, [indexer: string]: number, };
|
};
|
||||||
var a: ?{ numVal: number };
|
var a: {
|
||||||
var a: { numVal: number, strVal: string, };
|
numVal: number
|
||||||
var a: { subObj: { strVal: string } };
|
};
|
||||||
var a: { subObj: ?{ strVal: string } };
|
var a: {
|
||||||
var a: { param1: number, param2: string, };
|
numVal: number,
|
||||||
var a: { param1: number, param2?: string, };
|
[indexer: string]: number,
|
||||||
var a: { [a: number]: string, [b: number]: string, };
|
};
|
||||||
var a: { add: (x: number, ...y: Array<string>) => void };
|
var a: ?{
|
||||||
var a: { subtract: (x: number, ...y: Array<string>) => void };
|
numVal: number
|
||||||
var a: { id: <T>(x: T) => T };
|
};
|
||||||
|
var a: {
|
||||||
|
numVal: number,
|
||||||
|
strVal: string,
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
subObj: {
|
||||||
|
strVal: string
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
subObj: ?{
|
||||||
|
strVal: string
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
param1: number,
|
||||||
|
param2: string,
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
param1: number,
|
||||||
|
param2?: string,
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
[a: number]: string,
|
||||||
|
[b: number]: string,
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
add: (x: number, ...y: Array<string>) => void
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
subtract: (x: number, ...y: Array<string>) => void
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
id: <T>(x: T) => T
|
||||||
|
};
|
||||||
var a: Array<number> = [1, 2, 3];
|
var a: Array<number> = [1, 2, 3];
|
||||||
a = class Foo<T> {};
|
a = class Foo<T> {};
|
||||||
a = class Foo<T> extends Bar<T> {};
|
a = class Foo<T> extends Bar<T> {};
|
||||||
|
|
||||||
class Foo<T> {}
|
class Foo<T> {}
|
||||||
|
|
||||||
class Foo<T> extends Bar<T> {}
|
class Foo<T> extends Bar<T> {}
|
||||||
|
|
||||||
class Foo<T> extends mixin(Bar) {}
|
class Foo<T> extends mixin(Bar) {}
|
||||||
|
|
||||||
class Foo<T> {
|
class Foo<T> {
|
||||||
bar<U>(): number {
|
bar<U>(): number {
|
||||||
return 42;
|
return 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
"bar"<T>() {}
|
"bar"<T>() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function foo(requiredParam, optParam?) {}
|
function foo(requiredParam, optParam?) {}
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
prop1: string;
|
prop1: string;
|
||||||
prop2: number;
|
prop2: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
static prop1: string;
|
static prop1: string;
|
||||||
prop2: number;
|
prop2: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
var x: number | string = 4;
|
var x: number | string = 4;
|
||||||
|
|
||||||
class Array {
|
class Array {
|
||||||
concat(items: number | string) {}
|
concat(items: number | string) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var x: () => number | () => string = fn;
|
var x: () => number | () => string = fn;
|
||||||
var x: typeof Y = Y;
|
var x: typeof Y = Y;
|
||||||
var x: typeof Y | number = Y;
|
var x: typeof Y | number = Y;
|
||||||
var { x }: { x: string } = { x: "hello" };
|
var {
|
||||||
var { x }: { x: string } = { x: "hello" };
|
x
|
||||||
|
}: {
|
||||||
|
x: string
|
||||||
|
} = {
|
||||||
|
x: "hello"
|
||||||
|
};
|
||||||
|
var {
|
||||||
|
x
|
||||||
|
}: {
|
||||||
|
x: string
|
||||||
|
} = {
|
||||||
|
x: "hello"
|
||||||
|
};
|
||||||
var [x]: Array<string> = ["hello"];
|
var [x]: Array<string> = ["hello"];
|
||||||
function foo({ x }: { x: string }) {}
|
|
||||||
|
function foo({
|
||||||
|
x
|
||||||
|
}: {
|
||||||
|
x: string
|
||||||
|
}) {}
|
||||||
|
|
||||||
function foo([x]: Array<string>) {}
|
function foo([x]: Array<string>) {}
|
||||||
|
|
||||||
function foo(...rest: Array<number>) {}
|
function foo(...rest: Array<number>) {}
|
||||||
|
|
||||||
(function (...rest: Array<number>) {});
|
(function (...rest: Array<number>) {});
|
||||||
|
|
||||||
(...rest: Array<number>) => rest;
|
(...rest: Array<number>) => rest;
|
||||||
|
|
||||||
var a: Map<string, Array<string>>;
|
var a: Map<string, Array<string>>;
|
||||||
var a: Map<string, Array<string>>;
|
var a: Map<string, Array<string>>;
|
||||||
var a: number[];
|
var a: number[];
|
||||||
@ -109,21 +228,64 @@ import { type Foo as Bar } from "bar";
|
|||||||
import { typeof Foo as Bar } from "bar";
|
import { typeof Foo as Bar } from "bar";
|
||||||
export type { foo };
|
export type { foo };
|
||||||
export type { bar } from "bar";
|
export type { bar } from "bar";
|
||||||
export interface baz { p: number };
|
export interface baz {
|
||||||
export interface qux<T> { p: T };
|
p: number
|
||||||
|
}
|
||||||
|
;
|
||||||
|
export interface qux<T> {
|
||||||
|
p: T
|
||||||
|
}
|
||||||
|
;
|
||||||
var a: ?Array<?string>;
|
var a: ?Array<?string>;
|
||||||
var a: {| numVal: number |};
|
var a: {|
|
||||||
var a: {| numVal: number |};
|
numVal: number
|
||||||
var a: {| numVal: number, [indexer: string]: number, |};
|
|};
|
||||||
var a: ?{| numVal: number |};
|
var a: {|
|
||||||
var a: {| numVal: number, strVal: string, |};
|
numVal: number
|
||||||
var a: {| subObj: { strVal: string } |};
|
|};
|
||||||
var a: {| subObj: ?{ strVal: string } |};
|
var a: {|
|
||||||
var a: {| param1: number, param2: string, |};
|
numVal: number,
|
||||||
var a: {| param1: number, param2?: string, |};
|
[indexer: string]: number,
|
||||||
var a: {| [a: number]: string, [b: number]: string, |};
|
|};
|
||||||
var a: {| add: (x: number, ...y: Array<string>) => void |};
|
var a: ?{|
|
||||||
var a: {| subtract: (x: number, ...y: Array<string>) => void |};
|
numVal: number
|
||||||
var a: {| id: <T>(x: T) => T |};
|
|};
|
||||||
|
var a: {|
|
||||||
|
numVal: number,
|
||||||
|
strVal: string,
|
||||||
|
|};
|
||||||
|
var a: {|
|
||||||
|
subObj: {
|
||||||
|
strVal: string
|
||||||
|
}
|
||||||
|
|};
|
||||||
|
var a: {|
|
||||||
|
subObj: ?{
|
||||||
|
strVal: string
|
||||||
|
}
|
||||||
|
|};
|
||||||
|
var a: {|
|
||||||
|
param1: number,
|
||||||
|
param2: string,
|
||||||
|
|};
|
||||||
|
var a: {|
|
||||||
|
param1: number,
|
||||||
|
param2?: string,
|
||||||
|
|};
|
||||||
|
var a: {|
|
||||||
|
[a: number]: string,
|
||||||
|
[b: number]: string,
|
||||||
|
|};
|
||||||
|
var a: {|
|
||||||
|
add: (x: number, ...y: Array<string>) => void
|
||||||
|
|};
|
||||||
|
var a: {|
|
||||||
|
subtract: (x: number, ...y: Array<string>) => void
|
||||||
|
|};
|
||||||
|
var a: {|
|
||||||
|
id: <T>(x: T) => T
|
||||||
|
|};
|
||||||
|
|
||||||
function foo(numVal: number = 2) {}
|
function foo(numVal: number = 2) {}
|
||||||
|
|
||||||
function foo(numVal?: number = 2) {}
|
function foo(numVal?: number = 2) {}
|
||||||
|
|||||||
@ -3,19 +3,44 @@ type A<T = *> = T;
|
|||||||
type A<T: ?string = string> = T;
|
type A<T: ?string = string> = T;
|
||||||
type A<S, T: ?string = string> = T;
|
type A<S, T: ?string = string> = T;
|
||||||
type A<S = number, T: ?string = string> = T;
|
type A<S = number, T: ?string = string> = T;
|
||||||
class A<T = string> {};
|
|
||||||
class A<T: ?string = string> {};
|
class A<T = string> {}
|
||||||
class A<S, T: ?string = string> {};
|
|
||||||
class A<S = number, T: ?string = string> {};
|
;
|
||||||
|
|
||||||
|
class A<T: ?string = string> {}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
class A<S, T: ?string = string> {}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
class A<S = number, T: ?string = string> {}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
(class A<T = string> {});
|
(class A<T = string> {});
|
||||||
|
|
||||||
(class A<T: ?string = string> {});
|
(class A<T: ?string = string> {});
|
||||||
|
|
||||||
(class A<S, T: ?string = string> {});
|
(class A<S, T: ?string = string> {});
|
||||||
|
|
||||||
(class A<S = number, T: ?string = string> {});
|
(class A<S = number, T: ?string = string> {});
|
||||||
declare class A<T = string> {};
|
|
||||||
declare class A<T: ?string = string> {};
|
declare class A<T = string> {}
|
||||||
declare class A<S, T: ?string = string> {};
|
;
|
||||||
declare class A<S = number, T: ?string = string> {};
|
declare class A<T: ?string = string> {}
|
||||||
interface A<T = string> {};
|
;
|
||||||
interface A<T: ?string = string> {};
|
declare class A<S, T: ?string = string> {}
|
||||||
interface A<S, T: ?string = string> {};
|
;
|
||||||
interface A<S = number, T: ?string = string> {};
|
declare class A<S = number, T: ?string = string> {}
|
||||||
|
;
|
||||||
|
interface A<T = string> {}
|
||||||
|
;
|
||||||
|
interface A<T: ?string = string> {}
|
||||||
|
;
|
||||||
|
interface A<S, T: ?string = string> {}
|
||||||
|
;
|
||||||
|
interface A<S = number, T: ?string = string> {}
|
||||||
|
;
|
||||||
@ -1,4 +1,10 @@
|
|||||||
(xxx: number);
|
(xxx: number);
|
||||||
({ xxx: 0, yyy: "hey" }: { xxx: number, yyy: string, });
|
({
|
||||||
|
xxx: 0,
|
||||||
|
yyy: "hey"
|
||||||
|
}: {
|
||||||
|
xxx: number,
|
||||||
|
yyy: string,
|
||||||
|
});
|
||||||
(xxx => xxx + 1: (xxx: number) => number);
|
(xxx => xxx + 1: (xxx: number) => number);
|
||||||
(xxx: number), (yyy: string);
|
(xxx: number), (yyy: string);
|
||||||
@ -1,10 +1,39 @@
|
|||||||
var a: { numVal: number };
|
var a: {
|
||||||
var a: { numVal: number };
|
numVal: number
|
||||||
var a: { numVal: number, [indexer: string]: number, };
|
};
|
||||||
var a: ?{ numVal: number };
|
var a: {
|
||||||
var a: { numVal: number, strVal: string, };
|
numVal: number
|
||||||
var a: { subObj: { strVal: string } };
|
};
|
||||||
var a: { subObj: ?{ strVal: string } };
|
var a: {
|
||||||
var a: { param1: number, param2: string, };
|
numVal: number,
|
||||||
var a: { param1: number, param2?: string, };
|
[indexer: string]: number,
|
||||||
var a: { [a: number]: string, [b: number]: string, };
|
};
|
||||||
|
var a: ?{
|
||||||
|
numVal: number
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
numVal: number,
|
||||||
|
strVal: string,
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
subObj: {
|
||||||
|
strVal: string
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
subObj: ?{
|
||||||
|
strVal: string
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
param1: number,
|
||||||
|
param2: string,
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
param1: number,
|
||||||
|
param2?: string,
|
||||||
|
};
|
||||||
|
var a: {
|
||||||
|
[a: number]: string,
|
||||||
|
[b: number]: string,
|
||||||
|
};
|
||||||
|
|||||||
@ -1,10 +1,15 @@
|
|||||||
e => {
|
e => {
|
||||||
print("hello world");
|
print("hello world");
|
||||||
};
|
};
|
||||||
|
|
||||||
(e1, e2, e3) => {
|
(e1, e2, e3) => {
|
||||||
print("hello world");
|
print("hello world");
|
||||||
};
|
};
|
||||||
|
|
||||||
e => e;
|
e => e;
|
||||||
|
|
||||||
(e1, e2, e3) => e;
|
(e1, e2, e3) => e;
|
||||||
|
|
||||||
e => {};
|
e => {};
|
||||||
|
|
||||||
e => 20 + 20;
|
e => 20 + 20;
|
||||||
@ -1,5 +1,7 @@
|
|||||||
class Test {}
|
class Test {}
|
||||||
|
|
||||||
class Derived extends Super {}
|
class Derived extends Super {}
|
||||||
|
|
||||||
class StaticMethods {
|
class StaticMethods {
|
||||||
static n1() {}
|
static n1() {}
|
||||||
|
|
||||||
@ -8,7 +10,9 @@ class StaticMethods {
|
|||||||
static set set1(value) {}
|
static set set1(value) {}
|
||||||
|
|
||||||
static *gen1() {}
|
static *gen1() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Methods {
|
class Methods {
|
||||||
n2() {}
|
n2() {}
|
||||||
|
|
||||||
@ -17,7 +21,9 @@ class Methods {
|
|||||||
set set2(value) {}
|
set set2(value) {}
|
||||||
|
|
||||||
*gen1() {}
|
*gen1() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ComputedStaticMethods {
|
class ComputedStaticMethods {
|
||||||
static [n1]() {}
|
static [n1]() {}
|
||||||
|
|
||||||
@ -26,7 +32,9 @@ class ComputedStaticMethods {
|
|||||||
static set [set1](value) {}
|
static set [set1](value) {}
|
||||||
|
|
||||||
static *[gen1]() {}
|
static *[gen1]() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ComputedMethods {
|
class ComputedMethods {
|
||||||
[n2]() {}
|
[n2]() {}
|
||||||
|
|
||||||
@ -35,4 +43,5 @@ class ComputedMethods {
|
|||||||
set [set2](value) {}
|
set [set2](value) {}
|
||||||
|
|
||||||
*[gen1]() {}
|
*[gen1]() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,7 @@
|
|||||||
(class Test {});
|
(class Test {});
|
||||||
|
|
||||||
(class Derived extends Super {});
|
(class Derived extends Super {});
|
||||||
|
|
||||||
(class StaticMethods {
|
(class StaticMethods {
|
||||||
static n1() {}
|
static n1() {}
|
||||||
|
|
||||||
@ -8,7 +10,9 @@
|
|||||||
static set set1(value) {}
|
static set set1(value) {}
|
||||||
|
|
||||||
static *gen1() {}
|
static *gen1() {}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(class Methods {
|
(class Methods {
|
||||||
n2() {}
|
n2() {}
|
||||||
|
|
||||||
@ -17,7 +21,9 @@
|
|||||||
set set2(value) {}
|
set set2(value) {}
|
||||||
|
|
||||||
*gen1() {}
|
*gen1() {}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(class ComputedStaticMethods {
|
(class ComputedStaticMethods {
|
||||||
static [n1]() {}
|
static [n1]() {}
|
||||||
|
|
||||||
@ -26,7 +32,9 @@
|
|||||||
static set [set1](value) {}
|
static set [set1](value) {}
|
||||||
|
|
||||||
static *[gen1]() {}
|
static *[gen1]() {}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(class ComputedMethods {
|
(class ComputedMethods {
|
||||||
[n2]() {}
|
[n2]() {}
|
||||||
|
|
||||||
@ -35,5 +43,7 @@
|
|||||||
set [set2](value) {}
|
set [set2](value) {}
|
||||||
|
|
||||||
*[gen1]() {}
|
*[gen1]() {}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(class {});
|
(class {});
|
||||||
@ -1,12 +1,16 @@
|
|||||||
var object1 = {
|
var object1 = {
|
||||||
get [Symbol.create]() {},
|
get [Symbol.create]() {},
|
||||||
|
|
||||||
set [set()](value) {}
|
set [set()](value) {}
|
||||||
|
|
||||||
};
|
};
|
||||||
var object2 = {
|
var object2 = {
|
||||||
*[generator()]() {}
|
*[generator()]() {}
|
||||||
|
|
||||||
};
|
};
|
||||||
var object3 = {
|
var object3 = {
|
||||||
*[generator()]() {}
|
*[generator()]() {}
|
||||||
|
|
||||||
};
|
};
|
||||||
var object4 = {
|
var object4 = {
|
||||||
[Symbol.xxx]: "hello",
|
[Symbol.xxx]: "hello",
|
||||||
|
|||||||
@ -5,4 +5,5 @@ function b(p, q = 30) {}
|
|||||||
function c(p, q = 30, ...r) {}
|
function c(p, q = 30, ...r) {}
|
||||||
|
|
||||||
(p = 20) => {};
|
(p = 20) => {};
|
||||||
|
|
||||||
(p = 20, ...q) => {};
|
(p = 20, ...q) => {};
|
||||||
@ -1,15 +1,32 @@
|
|||||||
function t1({ responseText: responseText }) {}
|
function t1({
|
||||||
function t2({ responseText }) {}
|
responseText: responseText
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
function t2({
|
||||||
|
responseText
|
||||||
|
}) {}
|
||||||
|
|
||||||
function t3([a, b]) {}
|
function t3([a, b]) {}
|
||||||
|
|
||||||
var [i, j, k] = array;
|
var [i, j, k] = array;
|
||||||
var {
|
var {
|
||||||
i,
|
i,
|
||||||
j,
|
j,
|
||||||
k
|
k
|
||||||
} = obj;
|
} = obj;
|
||||||
let { i, j, k } = obj;
|
let {
|
||||||
const { i, j, k } = obj;
|
i,
|
||||||
var { value } = obj;
|
j,
|
||||||
|
k
|
||||||
|
} = obj;
|
||||||
|
const {
|
||||||
|
i,
|
||||||
|
j,
|
||||||
|
k
|
||||||
|
} = obj;
|
||||||
|
var {
|
||||||
|
value
|
||||||
|
} = obj;
|
||||||
var {
|
var {
|
||||||
value
|
value
|
||||||
} = obj;
|
} = obj;
|
||||||
@ -1,4 +1,6 @@
|
|||||||
var [a, b, ...rest] = array;
|
var [a, b, ...rest] = array;
|
||||||
const [a, b, ...rest] = array;
|
const [a, b, ...rest] = array;
|
||||||
|
|
||||||
function a([a, b, ...rest]) {}
|
function a([a, b, ...rest]) {}
|
||||||
|
|
||||||
([a, b, ...rest]) => {};
|
([a, b, ...rest]) => {};
|
||||||
@ -2,7 +2,6 @@ var escaped = `
|
|||||||
\u2028
|
\u2028
|
||||||
\u2029
|
\u2029
|
||||||
`;
|
`;
|
||||||
|
|
||||||
var escaped = `
|
var escaped = `
|
||||||
\v
|
\v
|
||||||
\b
|
\b
|
||||||
|
|||||||
@ -7,9 +7,7 @@ ${'the energy motron'}
|
|||||||
{
|
{
|
||||||
const foo = `spam
|
const foo = `spam
|
||||||
and eggs!`;
|
and eggs!`;
|
||||||
|
|
||||||
const bar = `${4 + 2}`;
|
const bar = `${4 + 2}`;
|
||||||
|
|
||||||
const hello = `Hello
|
const hello = `Hello
|
||||||
${'world'}`;
|
${'world'}`;
|
||||||
}
|
}
|
||||||
@ -1,27 +1,21 @@
|
|||||||
var hello = `hello`;
|
var hello = `hello`;
|
||||||
|
|
||||||
var hello = `
|
var hello = `
|
||||||
line
|
line
|
||||||
terminators`;
|
terminators`;
|
||||||
|
|
||||||
var tagged = tagged`hello`;
|
var tagged = tagged`hello`;
|
||||||
var tagged = member.call`hello`;
|
var tagged = member.call`hello`;
|
||||||
var tagged = new call`hello`();
|
var tagged = new call`hello`();
|
||||||
var tagged = new (call`hello`())();
|
var tagged = new (call`hello`())();
|
||||||
var tageed = member[call`hello`];
|
var tageed = member[call`hello`];
|
||||||
|
|
||||||
var middles = `
|
var middles = `
|
||||||
Is the order a rabbit?
|
Is the order a rabbit?
|
||||||
`;
|
`;
|
||||||
|
|
||||||
var middles = `
|
var middles = `
|
||||||
Is the order ${order}?
|
Is the order ${order}?
|
||||||
`;
|
`;
|
||||||
|
|
||||||
var middles = `
|
var middles = `
|
||||||
Is the order ${order}?
|
Is the order ${order}?
|
||||||
`;
|
`;
|
||||||
|
|
||||||
var middles = `
|
var middles = `
|
||||||
1. ${cocoa}
|
1. ${cocoa}
|
||||||
2. ${chino}
|
2. ${chino}
|
||||||
|
|||||||
@ -2,4 +2,5 @@ var foo = arr.map(v => ({
|
|||||||
x: v.bar,
|
x: v.bar,
|
||||||
y: v.bar * 2
|
y: v.bar * 2
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var fn = () => ({}).key;
|
var fn = () => ({}).key;
|
||||||
@ -9,5 +9,7 @@ async function asdf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function a(b) {
|
async function a(b) {
|
||||||
(await xhr({ url: "views/test.html" })).data;
|
(await xhr({
|
||||||
|
url: "views/test.html"
|
||||||
|
})).data;
|
||||||
}
|
}
|
||||||
@ -1,2 +1,4 @@
|
|||||||
a && a.b && a.b.c() && function () {}() && { a: 1 }.a;
|
a && a.b && a.b.c() && function () {}() && {
|
||||||
|
a: 1
|
||||||
|
}.a;
|
||||||
!function () {}();
|
!function () {}();
|
||||||
@ -3,7 +3,6 @@ function foo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (a, b, c) d();
|
if (a, b, c) d();
|
||||||
|
|
||||||
throw a, b, c;
|
throw a, b, c;
|
||||||
|
|
||||||
switch (a, b, c) {}
|
switch (a, b, c) {}
|
||||||
|
|||||||
@ -5,8 +5,7 @@ function foo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function foo() {
|
function foo() {
|
||||||
return (
|
return (// foobar
|
||||||
// foobar
|
|
||||||
"bar"
|
"bar"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -8,5 +8,7 @@ function* asdf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function* a(b) {
|
function* a(b) {
|
||||||
(yield xhr({ url: "views/test.html" })).data;
|
(yield xhr({
|
||||||
|
url: "views/test.html"
|
||||||
|
})).data;
|
||||||
}
|
}
|
||||||
@ -1 +1,3 @@
|
|||||||
({ set = {} }) => set;
|
({
|
||||||
|
set = {}
|
||||||
|
}) => set;
|
||||||
@ -1,4 +1,7 @@
|
|||||||
var foo = x => x * x;
|
var foo = x => x * x;
|
||||||
|
|
||||||
var foo = (a, b) => a * b;
|
var foo = (a, b) => a * b;
|
||||||
|
|
||||||
var foo = async x => x * x;
|
var foo = async x => x * x;
|
||||||
|
|
||||||
var foo = async (a, b) => a * b;
|
var foo = async (a, b) => a * b;
|
||||||
@ -1,5 +1,4 @@
|
|||||||
::foo.bar.foo;
|
::foo.bar.foo;
|
||||||
::foo.bar["foo"];
|
::foo.bar["foo"];
|
||||||
|
|
||||||
ctx::foo.bar.foo;
|
ctx::foo.bar.foo;
|
||||||
ctx::foo.bar["foo"];
|
ctx::foo.bar["foo"];
|
||||||
@ -1,5 +1,4 @@
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
{
|
{
|
||||||
foo();
|
foo();
|
||||||
}
|
}
|
||||||
@ -8,7 +8,6 @@ class Foo {
|
|||||||
["foo"] = 1;
|
["foo"] = 1;
|
||||||
["f" + "oo"];
|
["f" + "oo"];
|
||||||
["f" + "oo"] = 1;
|
["f" + "oo"] = 1;
|
||||||
|
|
||||||
static foo;
|
static foo;
|
||||||
static foo = 1;
|
static foo = 1;
|
||||||
static "foo";
|
static "foo";
|
||||||
@ -18,14 +17,15 @@ class Foo {
|
|||||||
static ["foo"] = 1;
|
static ["foo"] = 1;
|
||||||
static ["f" + "oo"];
|
static ["f" + "oo"];
|
||||||
static ["f" + "oo"] = 1;
|
static ["f" + "oo"] = 1;
|
||||||
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
static;
|
static;
|
||||||
static = 1;
|
static = 1;
|
||||||
async;
|
async;
|
||||||
foo;bar;
|
foo;
|
||||||
foo = 0;bar = 1;
|
bar;
|
||||||
|
foo = 0;
|
||||||
|
bar = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
class A1 {
|
class A1 {
|
||||||
@ -35,16 +35,21 @@ class A1 {
|
|||||||
|
|
||||||
class A2 {
|
class A2 {
|
||||||
get;
|
get;
|
||||||
|
|
||||||
*a() {}
|
*a() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class A3 {
|
class A3 {
|
||||||
static *a() {}
|
static *a() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class A4 {
|
class A4 {
|
||||||
async;
|
async;
|
||||||
|
|
||||||
a() {}
|
a() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class A5 {
|
class A5 {
|
||||||
@ -54,8 +59,10 @@ class A5 {
|
|||||||
|
|
||||||
class A6 {
|
class A6 {
|
||||||
get ['a']() {}
|
get ['a']() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class A7 {
|
class A7 {
|
||||||
static get static() {}
|
static get static() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,15 +1,24 @@
|
|||||||
class Foo {
|
class Foo {
|
||||||
async foo() {}
|
async foo() {}
|
||||||
|
|
||||||
foo() {}
|
foo() {}
|
||||||
|
|
||||||
["foo"]() {}
|
["foo"]() {}
|
||||||
|
|
||||||
get foo() {}
|
get foo() {}
|
||||||
|
|
||||||
set foo(bar) {}
|
set foo(bar) {}
|
||||||
|
|
||||||
static async foo() {}
|
static async foo() {}
|
||||||
|
|
||||||
static foo() {}
|
static foo() {}
|
||||||
|
|
||||||
static ["foo"]() {}
|
static ["foo"]() {}
|
||||||
|
|
||||||
static get foo() {}
|
static get foo() {}
|
||||||
|
|
||||||
static set foo(bar) {}
|
static set foo(bar) {}
|
||||||
|
|
||||||
static static() {}
|
static static() {}
|
||||||
|
|
||||||
get() {}
|
get() {}
|
||||||
@ -33,4 +42,5 @@ class Foo {
|
|||||||
get async() {}
|
get async() {}
|
||||||
|
|
||||||
static get static() {}
|
static get static() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,2 +1,3 @@
|
|||||||
class Foo {}
|
class Foo {}
|
||||||
|
|
||||||
class Foo extends Bar {}
|
class Foo extends Bar {}
|
||||||
@ -12,6 +12,7 @@ var obj = {
|
|||||||
|
|
||||||
@bar
|
@bar
|
||||||
set bar(foo) {}
|
set bar(foo) {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
@ -28,6 +29,7 @@ class Foo {
|
|||||||
|
|
||||||
@bar
|
@bar
|
||||||
set bar(foo) {}
|
set bar(foo) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@foo
|
@foo
|
||||||
@ -35,11 +37,12 @@ export default class Foo {
|
|||||||
bar() {
|
bar() {
|
||||||
class Baz {}
|
class Baz {}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
@foo
|
@foo
|
||||||
export class Foo {
|
export class Foo {
|
||||||
bar() {
|
bar() {
|
||||||
class Baz {}
|
class Baz {}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
(do {});
|
(do {});
|
||||||
|
|
||||||
let a = do {
|
let a = do {
|
||||||
if (x > 10) {
|
if (x > 10) {
|
||||||
'big';
|
'big';
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
for (var i = 0;;) {}
|
for (var i = 0;;) {}
|
||||||
|
|
||||||
for (var i = 0; i < 5;) {}
|
for (var i = 0; i < 5;) {}
|
||||||
|
|
||||||
for (var i = 0; i < 5; i++) {}
|
for (var i = 0; i < 5; i++) {}
|
||||||
@ -1,12 +1,9 @@
|
|||||||
foo["bar"];
|
foo["bar"];
|
||||||
foo.bar;
|
foo.bar;
|
||||||
|
|
||||||
foo.bar.foo;
|
foo.bar.foo;
|
||||||
foo.bar["foo"];
|
foo.bar["foo"];
|
||||||
|
|
||||||
foo["foo"]["bar"];
|
foo["foo"]["bar"];
|
||||||
foo[test()][bar()];
|
foo[test()][bar()];
|
||||||
|
|
||||||
0..toString();
|
0..toString();
|
||||||
0.5.toString();
|
0.5.toString();
|
||||||
1.0.toString();
|
1.0.toString();
|
||||||
|
|||||||
@ -1,20 +1,29 @@
|
|||||||
var foo = {};
|
var foo = {};
|
||||||
|
var foo = {
|
||||||
var foo = { x, y };
|
x,
|
||||||
|
y
|
||||||
var foo = { x: x, y: y };
|
};
|
||||||
|
var foo = {
|
||||||
|
x: x,
|
||||||
|
y: y
|
||||||
|
};
|
||||||
var foo = {
|
var foo = {
|
||||||
x: x,
|
x: x,
|
||||||
y: y
|
y: y
|
||||||
};
|
};
|
||||||
|
|
||||||
var foo = {
|
var foo = {
|
||||||
["bar"]: "foo",
|
["bar"]: "foo",
|
||||||
|
|
||||||
["foo"]() {},
|
["foo"]() {},
|
||||||
|
|
||||||
foo() {},
|
foo() {},
|
||||||
|
|
||||||
async foo() {},
|
async foo() {},
|
||||||
|
|
||||||
*foo() {},
|
*foo() {},
|
||||||
|
|
||||||
get foo() {},
|
get foo() {},
|
||||||
|
|
||||||
set foo(foo) {}
|
set foo(foo) {}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -5,7 +5,6 @@ foo?.(bar());
|
|||||||
foo?.(bar("test"));
|
foo?.(bar("test"));
|
||||||
foo(bar?.());
|
foo(bar?.());
|
||||||
foo(bar?.("test"));
|
foo(bar?.("test"));
|
||||||
|
|
||||||
a.foo?.();
|
a.foo?.();
|
||||||
a.foo?.("foo");
|
a.foo?.("foo");
|
||||||
a.foo?.("foo", "bar");
|
a.foo?.("foo", "bar");
|
||||||
@ -13,7 +12,6 @@ a.foo?.(bar());
|
|||||||
a.foo?.(bar("test"));
|
a.foo?.(bar("test"));
|
||||||
a.foo(bar?.());
|
a.foo(bar?.());
|
||||||
a.foo(bar?.("test"));
|
a.foo(bar?.("test"));
|
||||||
|
|
||||||
a?.foo?.();
|
a?.foo?.();
|
||||||
a?.foo?.("foo");
|
a?.foo?.("foo");
|
||||||
a?.foo?.("foo", "bar");
|
a?.foo?.("foo", "bar");
|
||||||
@ -21,7 +19,6 @@ a?.foo?.(bar());
|
|||||||
a?.foo?.(bar("test"));
|
a?.foo?.(bar("test"));
|
||||||
a?.foo(bar?.());
|
a?.foo(bar?.());
|
||||||
a?.foo(bar?.("test"));
|
a?.foo(bar?.("test"));
|
||||||
|
|
||||||
a.foo?.().baz;
|
a.foo?.().baz;
|
||||||
a.foo?.("foo").baz;
|
a.foo?.("foo").baz;
|
||||||
a.foo?.("foo", "bar").baz;
|
a.foo?.("foo", "bar").baz;
|
||||||
@ -29,7 +26,6 @@ a.foo?.(bar()).baz;
|
|||||||
a.foo?.(bar("test")).baz;
|
a.foo?.(bar("test")).baz;
|
||||||
a.foo(bar?.()).baz;
|
a.foo(bar?.()).baz;
|
||||||
a.foo(bar?.("test")).baz;
|
a.foo(bar?.("test")).baz;
|
||||||
|
|
||||||
a.foo?.()?.baz;
|
a.foo?.()?.baz;
|
||||||
a.foo?.("foo")?.baz;
|
a.foo?.("foo")?.baz;
|
||||||
a.foo?.("foo", "bar")?.baz;
|
a.foo?.("foo", "bar")?.baz;
|
||||||
|
|||||||
@ -5,7 +5,6 @@ foo?.(bar());
|
|||||||
foo?.(bar("test"));
|
foo?.(bar("test"));
|
||||||
foo(bar?.());
|
foo(bar?.());
|
||||||
foo(bar?.("test"));
|
foo(bar?.("test"));
|
||||||
|
|
||||||
a.foo?.();
|
a.foo?.();
|
||||||
a.foo?.("foo");
|
a.foo?.("foo");
|
||||||
a.foo?.("foo", "bar");
|
a.foo?.("foo", "bar");
|
||||||
@ -13,7 +12,6 @@ a.foo?.(bar());
|
|||||||
a.foo?.(bar("test"));
|
a.foo?.(bar("test"));
|
||||||
a.foo(bar?.());
|
a.foo(bar?.());
|
||||||
a.foo(bar?.("test"));
|
a.foo(bar?.("test"));
|
||||||
|
|
||||||
a?.foo?.();
|
a?.foo?.();
|
||||||
a?.foo?.("foo");
|
a?.foo?.("foo");
|
||||||
a?.foo?.("foo", "bar");
|
a?.foo?.("foo", "bar");
|
||||||
@ -21,7 +19,6 @@ a?.foo?.(bar());
|
|||||||
a?.foo?.(bar("test"));
|
a?.foo?.(bar("test"));
|
||||||
a?.foo(bar?.());
|
a?.foo(bar?.());
|
||||||
a?.foo(bar?.("test"));
|
a?.foo(bar?.("test"));
|
||||||
|
|
||||||
a.foo?.().baz;
|
a.foo?.().baz;
|
||||||
a.foo?.("foo").baz;
|
a.foo?.("foo").baz;
|
||||||
a.foo?.("foo", "bar").baz;
|
a.foo?.("foo", "bar").baz;
|
||||||
@ -29,7 +26,6 @@ a.foo?.(bar()).baz;
|
|||||||
a.foo?.(bar("test")).baz;
|
a.foo?.(bar("test")).baz;
|
||||||
a.foo(bar?.()).baz;
|
a.foo(bar?.()).baz;
|
||||||
a.foo(bar?.("test")).baz;
|
a.foo(bar?.("test")).baz;
|
||||||
|
|
||||||
a.foo?.()?.baz;
|
a.foo?.()?.baz;
|
||||||
a.foo?.("foo")?.baz;
|
a.foo?.("foo")?.baz;
|
||||||
a.foo?.("foo", "bar")?.baz;
|
a.foo?.("foo", "bar")?.baz;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
foo?.["bar"];
|
foo?.["bar"];
|
||||||
foo?.bar;
|
foo?.bar;
|
||||||
|
|
||||||
foo.bar?.foo;
|
foo.bar?.foo;
|
||||||
foo?.bar.foo;
|
foo?.bar.foo;
|
||||||
foo?.bar?.foo;
|
foo?.bar?.foo;
|
||||||
@ -10,7 +9,6 @@ foo?.bar?.["foo"];
|
|||||||
foo["bar"]?.foo;
|
foo["bar"]?.foo;
|
||||||
foo?.["bar"].foo;
|
foo?.["bar"].foo;
|
||||||
foo?.["bar"]?.foo;
|
foo?.["bar"]?.foo;
|
||||||
|
|
||||||
0.?.toString();
|
0.?.toString();
|
||||||
0.5?.toString();
|
0.5?.toString();
|
||||||
1.000?.toString();
|
1.000?.toString();
|
||||||
|
|||||||
@ -5,7 +5,6 @@ new foo?.(bar());
|
|||||||
new foo?.(bar("test"));
|
new foo?.(bar("test"));
|
||||||
foo(new bar?.());
|
foo(new bar?.());
|
||||||
foo(new bar?.("test"));
|
foo(new bar?.("test"));
|
||||||
|
|
||||||
new a.foo?.();
|
new a.foo?.();
|
||||||
new a.foo?.("foo");
|
new a.foo?.("foo");
|
||||||
new a.foo?.("foo", "bar");
|
new a.foo?.("foo", "bar");
|
||||||
@ -13,7 +12,6 @@ new a.foo?.(bar());
|
|||||||
new a.foo?.(bar("test"));
|
new a.foo?.(bar("test"));
|
||||||
a.foo(new bar?.());
|
a.foo(new bar?.());
|
||||||
a.foo(new bar?.("test"));
|
a.foo(new bar?.("test"));
|
||||||
|
|
||||||
new a?.foo?.();
|
new a?.foo?.();
|
||||||
new a?.foo?.("foo");
|
new a?.foo?.("foo");
|
||||||
new a?.foo?.("foo", "bar");
|
new a?.foo?.("foo", "bar");
|
||||||
@ -21,7 +19,6 @@ new a?.foo?.(bar());
|
|||||||
new a?.foo?.(bar("test"));
|
new a?.foo?.(bar("test"));
|
||||||
a?.foo(new bar?.());
|
a?.foo(new bar?.());
|
||||||
a?.foo(new bar?.("test"));
|
a?.foo(new bar?.("test"));
|
||||||
|
|
||||||
new a.foo?.().baz;
|
new a.foo?.().baz;
|
||||||
new a.foo?.("foo").baz;
|
new a.foo?.("foo").baz;
|
||||||
new a.foo?.("foo", "bar").baz;
|
new a.foo?.("foo", "bar").baz;
|
||||||
@ -29,7 +26,6 @@ new a.foo?.(bar()).baz;
|
|||||||
new a.foo?.(bar("test")).baz;
|
new a.foo?.(bar("test")).baz;
|
||||||
a.foo(new bar?.()).baz;
|
a.foo(new bar?.()).baz;
|
||||||
a.foo(new bar?.("test")).baz;
|
a.foo(new bar?.("test")).baz;
|
||||||
|
|
||||||
new a.foo?.()?.baz;
|
new a.foo?.()?.baz;
|
||||||
new a.foo?.("foo")?.baz;
|
new a.foo?.("foo")?.baz;
|
||||||
new a.foo?.("foo", "bar")?.baz;
|
new a.foo?.("foo", "bar")?.baz;
|
||||||
|
|||||||
@ -1,3 +1,19 @@
|
|||||||
var { ...{ z } } = { z: 1 };
|
var { ...{
|
||||||
var { ...{ x = 5 } } = { x: 1 };
|
z
|
||||||
({ x, ...{ y, z } } = o);
|
}
|
||||||
|
} = {
|
||||||
|
z: 1
|
||||||
|
};
|
||||||
|
var { ...{
|
||||||
|
x = 5
|
||||||
|
}
|
||||||
|
} = {
|
||||||
|
x: 1
|
||||||
|
};
|
||||||
|
({
|
||||||
|
x,
|
||||||
|
...{
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
}
|
||||||
|
} = o);
|
||||||
@ -1,3 +1,2 @@
|
|||||||
foo, bar;
|
foo, bar;
|
||||||
|
|
||||||
foo, bar;
|
foo, bar;
|
||||||
@ -35,8 +35,10 @@ switch (foo) {
|
|||||||
switch (foo) {
|
switch (foo) {
|
||||||
case "foo":
|
case "foo":
|
||||||
foo();
|
foo();
|
||||||
|
|
||||||
case "bar":
|
case "bar":
|
||||||
bar();
|
bar();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
yay();
|
yay();
|
||||||
}
|
}
|
||||||
@ -1,16 +1,12 @@
|
|||||||
html`<b></b>`;
|
html`<b></b>`;
|
||||||
|
|
||||||
`multi
|
`multi
|
||||||
lines`;
|
lines`;
|
||||||
|
|
||||||
`test ${interpolation} test`;
|
`test ${interpolation} test`;
|
||||||
|
|
||||||
`foob
|
`foob
|
||||||
|
|
||||||
asdf
|
asdf
|
||||||
awer
|
awer
|
||||||
erqer`;
|
erqer`;
|
||||||
|
|
||||||
tag`\unicode and \u{55}`;
|
tag`\unicode and \u{55}`;
|
||||||
tag`\01`;
|
tag`\01`;
|
||||||
tag`\xg${0}right`;
|
tag`\xg${0}right`;
|
||||||
|
|||||||
@ -1,15 +1,12 @@
|
|||||||
let foo;
|
let foo;
|
||||||
var foo;
|
var foo;
|
||||||
|
|
||||||
let foo = "foo";
|
let foo = "foo";
|
||||||
var foo = "bar";
|
var foo = "bar";
|
||||||
const foo = "foo";
|
const foo = "foo";
|
||||||
|
|
||||||
let foo,
|
let foo,
|
||||||
bar = "bar";
|
bar = "bar";
|
||||||
var foo,
|
var foo,
|
||||||
bar = "bar";
|
bar = "bar";
|
||||||
|
|
||||||
let foo = "foo",
|
let foo = "foo",
|
||||||
bar = "bar";
|
bar = "bar";
|
||||||
var foo = "foo",
|
var foo = "foo",
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
with (foo) {}
|
with (foo) {}
|
||||||
|
|
||||||
with (foo) {
|
with (foo) {
|
||||||
bar();
|
bar();
|
||||||
}
|
}
|
||||||
@ -1,11 +1,7 @@
|
|||||||
<div id="wow"></div>;
|
<div id="wow"></div>;
|
||||||
|
|
||||||
<div id="wow">text</div>;
|
<div id="wow">text</div>;
|
||||||
|
|
||||||
<div id="wow" disabled></div>;
|
<div id="wow" disabled></div>;
|
||||||
|
|
||||||
<div id="wow" disabled>text</div>;
|
<div id="wow" disabled>text</div>;
|
||||||
|
|
||||||
<div id="wôw" />;
|
<div id="wôw" />;
|
||||||
<div id="\w" />;
|
<div id="\w" />;
|
||||||
<div id="w < w" />;
|
<div id="w < w" />;
|
||||||
@ -1,5 +1,3 @@
|
|||||||
<div></div>;
|
<div></div>;
|
||||||
|
|
||||||
<div />;
|
<div />;
|
||||||
|
|
||||||
<div>text</div>;
|
<div>text</div>;
|
||||||
@ -1,12 +1,9 @@
|
|||||||
<div>wow</div>;
|
<div>wow</div>;
|
||||||
<div>wôw</div>;
|
<div>wôw</div>;
|
||||||
|
|
||||||
<div>w & w</div>;
|
<div>w & w</div>;
|
||||||
<div>w & w</div>;
|
<div>w & w</div>;
|
||||||
|
|
||||||
<div>w w</div>;
|
<div>w w</div>;
|
||||||
<div>this should not parse as unicode: \u00a0</div>;
|
<div>this should not parse as unicode: \u00a0</div>;
|
||||||
<div>this should parse as nbsp: </div>;
|
<div>this should parse as nbsp: </div>;
|
||||||
<div>this should parse as unicode: {'\u00a0 '}</div>;
|
<div>this should parse as unicode: {'\u00a0 '}</div>;
|
||||||
|
|
||||||
<div>w < w</div>;
|
<div>w < w</div>;
|
||||||
@ -1,4 +1,3 @@
|
|||||||
import Whitespace from "../lib/whitespace";
|
|
||||||
import Printer from "../lib/printer";
|
import Printer from "../lib/printer";
|
||||||
import generate from "../lib";
|
import generate from "../lib";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
@ -305,7 +304,12 @@ describe("programmatic generation", function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const output = generate(blockStatement).code;
|
const output = generate(blockStatement).code;
|
||||||
assert.equal(output, ["{", ' "use strict";', "}"].join("\n"));
|
assert.equal(
|
||||||
|
output,
|
||||||
|
`{
|
||||||
|
"use strict";
|
||||||
|
}`,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("flow object indentation", function() {
|
it("flow object indentation", function() {
|
||||||
@ -316,7 +320,12 @@ describe("programmatic generation", function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const output = generate(objectStatement).code;
|
const output = generate(objectStatement).code;
|
||||||
assert.equal(output, ["{", " bar: string,", "}"].join("\n"));
|
assert.equal(
|
||||||
|
output,
|
||||||
|
`{
|
||||||
|
bar: string
|
||||||
|
}`,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("flow object indentation with empty leading ObjectTypeProperty", function() {
|
it("flow object indentation with empty leading ObjectTypeProperty", function() {
|
||||||
@ -333,14 +342,12 @@ describe("programmatic generation", function() {
|
|||||||
|
|
||||||
const output = generate(objectStatement).code;
|
const output = generate(objectStatement).code;
|
||||||
|
|
||||||
assert.equal(output, ["{", " [key: any]: Test,", "}"].join("\n"));
|
assert.equal(
|
||||||
});
|
output,
|
||||||
});
|
`{
|
||||||
|
[key: any]: Test
|
||||||
describe("whitespace", function() {
|
}`,
|
||||||
it("empty token list", function() {
|
);
|
||||||
const w = new Whitespace([]);
|
|
||||||
assert.equal(w.getNewlinesBefore(t.stringLiteral("1")), 0);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,15 @@ var a = 1,
|
|||||||
b = 2;
|
b = 2;
|
||||||
var c = 3,
|
var c = 3,
|
||||||
d = 4;
|
d = 4;
|
||||||
var _e$f = { e: 5, f: 6 },
|
var _e$f = {
|
||||||
|
e: 5,
|
||||||
|
f: 6
|
||||||
|
},
|
||||||
e = _e$f.e,
|
e = _e$f.e,
|
||||||
f = _e$f.f;
|
f = _e$f.f;
|
||||||
var _a$b = { a: 7, b: 8 },
|
var _a$b = {
|
||||||
|
a: 7,
|
||||||
|
b: 8
|
||||||
|
},
|
||||||
g = _a$b.a,
|
g = _a$b.a,
|
||||||
h = _a$b.b;
|
h = _a$b.b;
|
||||||
@ -9,4 +9,5 @@ class C {
|
|||||||
return 3;
|
return 3;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -9,4 +9,5 @@
|
|||||||
return 3;
|
return 3;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -9,4 +9,5 @@ class C {
|
|||||||
return 3;
|
return 3;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -6,7 +6,6 @@ babelHelpers.asyncToGenerator(function* () {
|
|||||||
try {
|
try {
|
||||||
for (var _iterator = babelHelpers.asyncIterator(y), _step, _value; _step = yield _iterator.next(), _iteratorNormalCompletion = _step.done, _value = yield _step.value, !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
|
for (var _iterator = babelHelpers.asyncIterator(y), _step, _value; _step = yield _iterator.next(), _iteratorNormalCompletion = _step.done, _value = yield _step.value, !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
|
||||||
let x = _value;
|
let x = _value;
|
||||||
|
|
||||||
f(x);
|
f(x);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -7,7 +7,6 @@ let f = (() => {
|
|||||||
try {
|
try {
|
||||||
for (var _iterator = babelHelpers.asyncIterator(y), _step, _value; _step = yield _iterator.next(), _iteratorNormalCompletion = _step.done, _value = yield _step.value, !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
|
for (var _iterator = babelHelpers.asyncIterator(y), _step, _value; _step = yield _iterator.next(), _iteratorNormalCompletion = _step.done, _value = yield _step.value, !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
|
||||||
let x = _value;
|
let x = _value;
|
||||||
|
|
||||||
g(x);
|
g(x);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -7,7 +7,6 @@ let g = (() => {
|
|||||||
try {
|
try {
|
||||||
for (var _iterator = babelHelpers.asyncIterator(y), _step, _value; _step = yield babelHelpers.asyncGenerator.await(_iterator.next()), _iteratorNormalCompletion = _step.done, _value = yield babelHelpers.asyncGenerator.await(_step.value), !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
|
for (var _iterator = babelHelpers.asyncIterator(y), _step, _value; _step = yield babelHelpers.asyncGenerator.await(_iterator.next()), _iteratorNormalCompletion = _step.done, _value = yield babelHelpers.asyncGenerator.await(_step.value), !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
|
||||||
let x = _value;
|
let x = _value;
|
||||||
|
|
||||||
f(x);
|
f(x);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -6,8 +6,10 @@ let f = (() => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
for (var _iterator = babelHelpers.asyncIterator(a), _step, _value; _step = yield _iterator.next(), _iteratorNormalCompletion = _step.done, _value = yield _step.value, !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
|
for (var _iterator = babelHelpers.asyncIterator(a), _step, _value; _step = yield _iterator.next(), _iteratorNormalCompletion = _step.done, _value = yield _step.value, !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
|
||||||
let { x, y: [z] } = _value;
|
let {
|
||||||
|
x,
|
||||||
|
y: [z]
|
||||||
|
} = _value;
|
||||||
g(x, z);
|
g(x, z);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user