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

Commit 9bb83dd

Browse files
committed
fantomas
1 parent 5f9aefa commit 9bb83dd

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

src/QsFmt/Formatter/ParseTree/Statement.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ type StatementVisitor(tokens) =
105105
Node.toUnknown tokens node |> Statement.Unknown
106106

107107
override _.VisitExpressionStatement context =
108-
{ Expression = context.value |> expressionVisitor.Visit; Semicolon = context.semicolon |> Node.toTerminal tokens }
108+
{
109+
Expression = context.value |> expressionVisitor.Visit
110+
Semicolon = context.semicolon |> Node.toTerminal tokens
111+
}
109112
|> ExpressionStatement
110113

111114
override _.VisitReturnStatement context =
@@ -169,7 +172,7 @@ type StatementVisitor(tokens) =
169172
{
170173
SetKeyword = context.set |> Node.toTerminal tokens
171174
Name = context.name |> Node.toTerminal tokens
172-
With = context.``with`` |> Node.toTerminal tokens
175+
With = context.``with`` |> Node.toTerminal tokens
173176
Item = expressionVisitor.Visit context.index
174177
Arrow = context.arrow |> Node.toTerminal tokens
175178
Value = expressionVisitor.Visit context.value

src/QsFmt/Formatter/SyntaxTree/Reducer.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type internal 'result Reducer() as reducer =
1111
let reduce = curry reducer.Combine |> List.reduce
1212

1313
/// The default behavior to reduce a SimpleStatement.
14-
let defaultSimpleStatement (statement : SimpleStatement) =
14+
let defaultSimpleStatement (statement: SimpleStatement) =
1515
[
1616
reducer.Terminal statement.Keyword
1717
reducer.Expression statement.Expression
@@ -20,7 +20,7 @@ type internal 'result Reducer() as reducer =
2020
|> reduce
2121

2222
/// The default behavior to reduce a BindingStatement.
23-
let defaultBindingStatement (statement : BindingStatement) =
23+
let defaultBindingStatement (statement: BindingStatement) =
2424
[
2525
reducer.Terminal statement.Keyword
2626
reducer.SymbolBinding statement.Binding
@@ -31,7 +31,7 @@ type internal 'result Reducer() as reducer =
3131
|> reduce
3232

3333
/// The default behavior to reduce a ConditionalBlockStatement.
34-
let defaultConditionalBlockStatement (statement : ConditionalBlockStatement) =
34+
let defaultConditionalBlockStatement (statement: ConditionalBlockStatement) =
3535
[
3636
reducer.Terminal statement.Keyword
3737
reducer.Expression statement.Condition
@@ -40,7 +40,7 @@ type internal 'result Reducer() as reducer =
4040
|> reduce
4141

4242
/// The default behavior to reduce a BlockStatement.
43-
let defaultBlockStatement (statement : BlockStatement) =
43+
let defaultBlockStatement (statement: BlockStatement) =
4444
[
4545
reducer.Terminal statement.Keyword
4646
reducer.Block(reducer.Statement, statement.Block)

src/QsFmt/Formatter/SyntaxTree/Rewriter.fs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ type 'context Rewriter() as rewriter =
216216
abstract ExpressionStatement : context: 'context * expr: ExpressionStatement -> ExpressionStatement
217217

218218
default rewriter.ExpressionStatement(context, expr) =
219-
{ Expression = rewriter.Expression(context, expr.Expression); Semicolon = rewriter.Terminal(context, expr.Semicolon) }
219+
{
220+
Expression = rewriter.Expression(context, expr.Expression)
221+
Semicolon = rewriter.Terminal(context, expr.Semicolon)
222+
}
220223

221224
abstract Return : context: 'context * returns: SimpleStatement -> SimpleStatement
222225

@@ -232,7 +235,8 @@ type 'context Rewriter() as rewriter =
232235

233236
abstract Mutable : context: 'context * mutables: BindingStatement -> BindingStatement
234237

235-
default _.Mutable(context, mutables) = defaultBindingStatement context mutables
238+
default _.Mutable(context, mutables) =
239+
defaultBindingStatement context mutables
236240

237241
abstract SetStatement : context: 'context * sets: BindingStatement -> BindingStatement
238242

@@ -264,11 +268,13 @@ type 'context Rewriter() as rewriter =
264268

265269
abstract If : context: 'context * ifs: ConditionalBlockStatement -> ConditionalBlockStatement
266270

267-
default _.If(context, ifs) = defaultConditionalBlockStatement context ifs
271+
default _.If(context, ifs) =
272+
defaultConditionalBlockStatement context ifs
268273

269274
abstract Elif : context: 'context * elifs: ConditionalBlockStatement -> ConditionalBlockStatement
270275

271-
default _.Elif(context, elifs) = defaultConditionalBlockStatement context elifs
276+
default _.Elif(context, elifs) =
277+
defaultConditionalBlockStatement context elifs
272278

273279
abstract Else : context: 'context * elses: BlockStatement -> BlockStatement
274280

@@ -287,7 +293,8 @@ type 'context Rewriter() as rewriter =
287293

288294
abstract While : context: 'context * whiles: ConditionalBlockStatement -> ConditionalBlockStatement
289295

290-
default _.While(context, whiles) = defaultConditionalBlockStatement context whiles
296+
default _.While(context, whiles) =
297+
defaultConditionalBlockStatement context whiles
291298

292299
abstract Repeat : context: 'context * repeats: BlockStatement -> BlockStatement
293300

src/QsFmt/Formatter/SyntaxTree/Statement.fs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,7 @@ type ConditionalBlockStatement =
124124

125125
// Else, Repeat, Within, and Apply Statements
126126

127-
and BlockStatement =
128-
{
129-
Keyword: Terminal
130-
Block: Statement Block
131-
}
127+
and BlockStatement = { Keyword: Terminal; Block: Statement Block }
132128

133129
// For Statement
134130

@@ -198,18 +194,14 @@ module Statement =
198194
function
199195
| ExpressionStatement expr ->
200196
{ expr with Expression = expr.Expression |> Expression.mapPrefix mapper } |> ExpressionStatement
201-
| Return returns ->
202-
{ returns with Keyword = returns.Keyword |> Terminal.mapPrefix mapper } |> Return
197+
| Return returns -> { returns with Keyword = returns.Keyword |> Terminal.mapPrefix mapper } |> Return
203198
| Fail fails -> { fails with Keyword = fails.Keyword |> Terminal.mapPrefix mapper } |> Fail
204199
| Let lets -> { lets with Keyword = lets.Keyword |> Terminal.mapPrefix mapper } |> Let
205-
| Mutable mutables ->
206-
{ mutables with Keyword = mutables.Keyword |> Terminal.mapPrefix mapper } |> Mutable
207-
| SetStatement sets ->
208-
{ sets with Keyword = sets.Keyword |> Terminal.mapPrefix mapper } |> SetStatement
200+
| Mutable mutables -> { mutables with Keyword = mutables.Keyword |> Terminal.mapPrefix mapper } |> Mutable
201+
| SetStatement sets -> { sets with Keyword = sets.Keyword |> Terminal.mapPrefix mapper } |> SetStatement
209202
| UpdateStatement updates ->
210203
{ updates with SetKeyword = updates.SetKeyword |> Terminal.mapPrefix mapper } |> UpdateStatement
211-
| SetWith withs ->
212-
{ withs with SetKeyword = withs.SetKeyword |> Terminal.mapPrefix mapper } |> SetWith
204+
| SetWith withs -> { withs with SetKeyword = withs.SetKeyword |> Terminal.mapPrefix mapper } |> SetWith
213205
| If ifs -> { ifs with Keyword = ifs.Keyword |> Terminal.mapPrefix mapper } |> If
214206
| Elif elifs -> { elifs with Keyword = elifs.Keyword |> Terminal.mapPrefix mapper } |> Elif
215207
| Else elses -> { elses with Keyword = elses.Keyword |> Terminal.mapPrefix mapper } |> Else

0 commit comments

Comments
 (0)