Skip to content

Commit

Permalink
Remove implicitCtor in TypeDefnExplicitNode. (#2679)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf authored Jan 4, 2023
1 parent 96a5b7a commit 1eb5725
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
10 changes: 2 additions & 8 deletions src/Fantomas.Core/ASTTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2229,12 +2229,6 @@ let mkTypeDefn
kind = SynTypeDefnKind.Class | SynTypeDefnKind.Interface | SynTypeDefnKind.Struct as tdk
members = objectMembers
range = range) ->
let implicitConstructorNode =
match implicitConstructor with
| Some(SynMemberDefn.ImplicitCtor(vis, attrs, pats, self, xmlDoc, m)) ->
mkImplicitCtor creationAide vis attrs pats self xmlDoc m |> Some
| _ -> None

let kindNode =
match tdk, range with
| SynTypeDefnKind.Class, StartRange 5 (mClass, _) -> stn "class" mClass
Expand All @@ -2255,7 +2249,7 @@ let mkTypeDefn

let body = TypeDefnExplicitBodyNode(kindNode, objectMembers, endNode, range)

TypeDefnExplicitNode(typeNameNode, implicitConstructorNode, body, members, typeDefnRange)
TypeDefnExplicitNode(typeNameNode, body, members, typeDefnRange)
|> TypeDefn.Explicit

| SynTypeDefnRepr.ObjectModel(kind = SynTypeDefnKind.Augmentation mWith) ->
Expand Down Expand Up @@ -2958,7 +2952,7 @@ let mkTypeDefnSig (creationAide: CreationAide) (SynTypeDefnSig(typeInfo, typeRep

let body = TypeDefnExplicitBodyNode(kindNode, objectMembers, endNode, range)

TypeDefnExplicitNode(typeNameNode, None, body, members, typeDefnRange)
TypeDefnExplicitNode(typeNameNode, body, members, typeDefnRange)
|> TypeDefn.Explicit

| SynTypeDefnSigRepr.ObjectModel(kind = SynTypeDefnKind.Augmentation mWith) ->
Expand Down
5 changes: 1 addition & 4 deletions src/Fantomas.Core/SyntaxOak.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2382,17 +2382,14 @@ type TypeDefnExplicitBodyNode(kind: SingleTextNode, members: MemberDefn list, en
member x.Members = members
member x.End = endNode

type TypeDefnExplicitNode
(typeNameNode, implicitCtor: ImplicitConstructorNode option, body: TypeDefnExplicitBodyNode, members, range) =
type TypeDefnExplicitNode(typeNameNode, body: TypeDefnExplicitBodyNode, members, range) =
inherit NodeBase(range)

override this.Children =
[| yield typeNameNode
yield! noa implicitCtor
yield body
yield! nodes (List.map MemberDefn.Node members) |]

member x.ImplicitConstructor = implicitCtor
member x.Body = body

interface ITypeDefn with
Expand Down

0 comments on commit 1eb5725

Please sign in to comment.