Skip to content

Commit

Permalink
Remove SynArg
Browse files Browse the repository at this point in the history
  • Loading branch information
vipentti committed Dec 22, 2023
1 parent 2c4c94b commit 95f351b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 47 deletions.
17 changes: 0 additions & 17 deletions src/Visp.Compiler/Syntax/SynWriter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1654,22 +1654,6 @@ module Write =
writeExpr w WriteState.InlineNoParens arg
| _ -> writeSeqLeading w WriteState.Inline space writeExprInParens args

and writeArgsOrEmpty w (args: SynArg list) =
let writeArgs w args =
writeSeq w WriteState.Inline space writeArg args

if args.IsEmpty then string w "()" else writeArgs w args

and private writeArg w _ (arg: SynArg) =
match arg with
| SynArg.TypedArg(name, typ, _) ->
char w '('
symbol w name true
string w ": "
writeType w typ
char w ')'
| SynArg.InferredArg(name, _) -> symbol w name true

and private writeExprToValue w st (expr: SynExpr) =
match expr with
| SynExpr.Const(cnst, range) ->
Expand All @@ -1684,7 +1668,6 @@ module Write =
writeExpr w WriteState.Inline others
char w ')'


and private writeQuotedInParens w (st: WriteState) ex =
let needsParens =
match ex with
Expand Down
24 changes: 0 additions & 24 deletions src/Visp.Compiler/Syntax/Syntax.fs
Original file line number Diff line number Diff line change
Expand Up @@ -515,17 +515,6 @@ and SynLambda =
let (SynLambda(_, _, rng)) = this
rng

and [<RequireQualifiedAccess>] SynArg =
// Argument with explicit type
| TypedArg of name: SynSymbol * argtype: SynType * range: range
// Argument with inferred type
| InferredArg of name: SynSymbol * range: range

member d.NameText =
match d with
| TypedArg(name = name)
| InferredArg(name = name) -> name.Text

module Coll =
let mkList its r =
(SynCollection(CollectionKind.Paren, its, r))
Expand Down Expand Up @@ -669,16 +658,6 @@ module Syntax =
| SynName.Inferred(it, _) -> rangeOfSymbol it
| SynName.Typed(it, _, _) -> rangeOfSymbol it

let textOfArg =
function
| SynArg.InferredArg(it, _) -> textOfSymbol it
| SynArg.TypedArg(it, _, _) -> textOfSymbol it

let rangeOfArg =
function
| SynArg.InferredArg(it, _) -> rangeOfSymbol it
| SynArg.TypedArg(it, _, _) -> rangeOfSymbol it

let mkFunctionCall sym ex range = SynExpr.FunctionCall(sym, ex, range)

let mkCons lhs rhs range = SynExpr.Cons(lhs, rhs, range)
Expand Down Expand Up @@ -709,9 +688,6 @@ module Syntax =
let mkUnwrapList v r =
mkFunctionCall (mkSynSymbolExpr "unwrapList" r) [ v ] r

let mkInferredArg s range =
SynArg.InferredArg(mkSynSymbol s range, range)

let mkFunctionCallOrCexpr ex args r =
match ex with
| SynExpr.Symbol(SynSymbol(id) as sym) when id.idText.EndsWith("->") && id.idText.Length > 2 ->
Expand Down
6 changes: 0 additions & 6 deletions src/Visp.Compiler/Syntax/SyntaxPrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,6 @@ let patToDoc =
| SynPat.Named(it, _) -> text it.Text
| it -> failwithf "todo pat: %A" it

let argToDoc =
function
| SynArg.InferredArg(it, _) -> text it.Text
| SynArg.TypedArg(name, typ, _) ->
brackets <| (cat [ text name.Text; colon; space; text "todo types" ])

let lambdaToDoc (SynLambda(args, body, _)) =
//let args = List.map argToDoc args |> hsep |> parens
let args = patToDoc args
Expand Down

0 comments on commit 95f351b

Please sign in to comment.