mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 20:37:00 -05:00
Remove flag and compare position
This commit is contained in:
@@ -3292,16 +3292,17 @@ module ts {
|
||||
|
||||
function emitSignatureParametersForArrow(node: FunctionLikeDeclaration) {
|
||||
// Check whether the parameter list needs parentheses and preserve no-parenthesis
|
||||
if (node.flags & NodeFlags.SimpleArrowFunction) {
|
||||
increaseIndent();
|
||||
var parameters = node.parameters;
|
||||
var omitCount = hasRestParameters(node) ? 1 : 0;
|
||||
emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false);
|
||||
decreaseIndent();
|
||||
}
|
||||
else {
|
||||
emitSignatureParameters(node);
|
||||
if (node.parameters.length === 1){
|
||||
if (node.pos === node.parameters[0].pos) {
|
||||
increaseIndent();
|
||||
var parameters = node.parameters;
|
||||
var omitCount = hasRestParameters(node) ? 1 : 0;
|
||||
emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false);
|
||||
decreaseIndent();
|
||||
return;
|
||||
}
|
||||
}
|
||||
emitSignatureParameters(node);
|
||||
}
|
||||
|
||||
function emitSignatureAndBody(node: FunctionLikeDeclaration) {
|
||||
|
||||
@@ -2883,9 +2883,6 @@ module ts {
|
||||
node.parameters = <NodeArray<ParameterDeclaration>>[parameter];
|
||||
node.parameters.pos = parameter.pos;
|
||||
node.parameters.end = parameter.end;
|
||||
// Add node flags for simple arrow function(no parenthesis around parameters)
|
||||
// so that in emit state we can check this flag and preserve users original text
|
||||
node.flags |= NodeFlags.SimpleArrowFunction;
|
||||
|
||||
parseExpected(SyntaxKind.EqualsGreaterThanToken);
|
||||
node.body = parseArrowFunctionExpressionBody();
|
||||
|
||||
@@ -293,8 +293,6 @@ module ts {
|
||||
Const = 0x00001000, // Variable declaration
|
||||
OctalLiteral = 0x00002000,
|
||||
|
||||
SimpleArrowFunction = 0x00004000, // Arrow function without parenthesized parameters
|
||||
|
||||
Modifier = Export | Ambient | Public | Private | Protected | Static,
|
||||
AccessibilityModifier = Public | Private | Protected,
|
||||
BlockScoped = Let | Const
|
||||
|
||||
Reference in New Issue
Block a user