Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Chore: Wrap any parameter with modifers, not just in constructors #214

Merged
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
34 changes: 15 additions & 19 deletions lib/ast-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1217,20 +1217,6 @@ module.exports = function(ast, extra) {
return convertChild(d.expression);
}) : [];

if (param.modifiers) {
return {
type: "TSParameterProperty",
range: [param.getStart(), param.end],
loc: getLoc(param, ast),
accessibility: getTSNodeAccessibility(param),
isReadonly: param.modifiers.some(function(modifier) {
return modifier.kind === SyntaxKind.ReadonlyKeyword;
}),
parameter: convertedParam,
decorators: decorators
};
}

return assign(convertedParam, {
decorators: decorators
});
Expand Down Expand Up @@ -1499,11 +1485,8 @@ module.exports = function(ast, extra) {
right: convertChild(node.initializer)
});
} else {
var convertedParameter = convert(node.name, parent);
if (node.type) {
convertedParameter.typeAnnotation = convertTypeAnnotation(node.type);
}
return convertedParameter;
parameter = convert(node.name, parent);
result = parameter;
}

if (node.type) {
Expand All @@ -1512,6 +1495,19 @@ module.exports = function(ast, extra) {
});
}

if (node.modifiers) {
return {
type: "TSParameterProperty",
range: [node.getStart(), node.end],
loc: getLoc(node, ast),
accessibility: getTSNodeAccessibility(node),
isReadonly: node.modifiers.some(function(modifier) {
return modifier.kind === SyntaxKind.ReadonlyKeyword;
}),
parameter: result
};
}

break;

// Classes
Expand Down
Loading