Skip to content

Commit 2802798

Browse files
committed
Add type functions to SyntaxNormalizer
1 parent b34459f commit 2802798

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Compilers/Lua/Portable/Syntax/SyntaxNormalizer.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,20 @@ private TReturn WithTempState<TArg, TReturn>(Func<TArg, TReturn> func, TArg arg)
732732
return base.VisitTypeDeclarationStatement(node);
733733
}
734734

735+
// type_function_declaration_statement
736+
// : 'export'? 'type' 'function' identifier_token parameter_list type_binding? statement_list 'end' ';'?
737+
// ;
738+
public override SyntaxNode? VisitTypeFunctionDeclarationStatement(TypeFunctionDeclarationStatementSyntax node)
739+
{
740+
AddSpaceAfterToken(node.ExportKeyword);
741+
AddSpaceAfterToken(node.TypeKeyword);
742+
AddSpaceAfterToken(node.FunctionKeyword);
743+
AddLineBreaksAfterToken(node.TypeBinding?.GetLastToken() ?? node.Parameters.GetLastToken());
744+
AddLineBreaksAfterToken(node.Body.GetLastToken());
745+
746+
return base.VisitTypeFunctionDeclarationStatement(node);
747+
}
748+
735749
// while_statement
736750
// : 'while' expression 'do' statement_list 'end' ';'?
737751
// ;

0 commit comments

Comments
 (0)