Skip to content

Commit

Permalink
Use case let as instead of case is and force casting later. (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
5sw authored Oct 5, 2020
1 parent ff68cfe commit fdfa661
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions Down.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
EEEBEE70225D2B9D00AE438D /* DebugVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEEBEE6F225D2B9D00AE438D /* DebugVisitor.swift */; };
EEEBEE72225D2F9200AE438D /* AttributedStringVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEEBEE71225D2F9200AE438D /* AttributedStringVisitor.swift */; };
EEF1376F2259E53400D7DDE0 /* Node.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF1376E2259E53400D7DDE0 /* Node.swift */; };
EEF137712259E7E700D7DDE0 /* Vistor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF137702259E7E700D7DDE0 /* Vistor.swift */; };
EEF137712259E7E700D7DDE0 /* Visitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF137702259E7E700D7DDE0 /* Visitor.swift */; };
EEF8580F22FA101C0025370B /* DownDebugLayoutManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF8580E22FA101C0025370B /* DownDebugLayoutManager.swift */; };
EEF8581122FA11690025370B /* DownDebugTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF8581022FA11690025370B /* DownDebugTextView.swift */; };
EEFFFDDB22F4C36800036FD5 /* ThematicBreakAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFFFDDA22F4C36800036FD5 /* ThematicBreakAttribute.swift */; };
Expand Down Expand Up @@ -340,7 +340,7 @@
EEEBEE6F225D2B9D00AE438D /* DebugVisitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugVisitor.swift; sourceTree = "<group>"; };
EEEBEE71225D2F9200AE438D /* AttributedStringVisitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedStringVisitor.swift; sourceTree = "<group>"; };
EEF1376E2259E53400D7DDE0 /* Node.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Node.swift; sourceTree = "<group>"; };
EEF137702259E7E700D7DDE0 /* Vistor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Vistor.swift; sourceTree = "<group>"; };
EEF137702259E7E700D7DDE0 /* Visitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Visitor.swift; sourceTree = "<group>"; };
EEF8580E22FA101C0025370B /* DownDebugLayoutManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownDebugLayoutManager.swift; sourceTree = "<group>"; };
EEF8581022FA11690025370B /* DownDebugTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownDebugTextView.swift; sourceTree = "<group>"; };
EEFFFDDA22F4C36800036FD5 /* ThematicBreakAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThematicBreakAttribute.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -718,7 +718,7 @@
EEEBEE71225D2F9200AE438D /* AttributedStringVisitor.swift */,
EE8F38CD22BFEDE50056270E /* ListItemPrefixGenerator.swift */,
EEEBEE6F225D2B9D00AE438D /* DebugVisitor.swift */,
EEF137702259E7E700D7DDE0 /* Vistor.swift */,
EEF137702259E7E700D7DDE0 /* Visitor.swift */,
);
path = Visitors;
sourceTree = "<group>";
Expand Down Expand Up @@ -1001,7 +1001,7 @@
EEEBEE5F225D2AA700AE438D /* LineBreak.swift in Sources */,
EEEBEE61225D2AC000AE438D /* Code.swift in Sources */,
8A569F491E6B3ED9008BE2AC /* blocks.c in Sources */,
EEF137712259E7E700D7DDE0 /* Vistor.swift in Sources */,
EEF137712259E7E700D7DDE0 /* Visitor.swift in Sources */,
EEEBEE53225D2A3C00AE438D /* CustomBlock.swift in Sources */,
EEEBEE69225D2B1200AE438D /* Strong.swift in Sources */,
EEEBEE47225D298D00AE438D /* Document.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,26 @@ extension Visitor {
public func visitChildren(of node: Node) -> [Result] {
return node.children.compactMap { child in
switch child {
case is Document: return visit(document: child as! Document)
case is BlockQuote: return visit(blockQuote: child as! BlockQuote)
case is List: return visit(list: child as! List)
case is Item: return visit(item: child as! Item)
case is CodeBlock: return visit(codeBlock: child as! CodeBlock)
case is HtmlBlock: return visit(htmlBlock: child as! HtmlBlock)
case is CustomBlock: return visit(customBlock: child as! CustomBlock)
case is Paragraph: return visit(paragraph: child as! Paragraph)
case is Heading: return visit(heading: child as! Heading)
case is ThematicBreak: return visit(thematicBreak: child as! ThematicBreak)
case is Text: return visit(text: child as! Text)
case is SoftBreak: return visit(softBreak: child as! SoftBreak)
case is LineBreak: return visit(lineBreak: child as! LineBreak)
case is Code: return visit(code: child as! Code)
case is HtmlInline: return visit(htmlInline: child as! HtmlInline)
case is CustomInline: return visit(customInline: child as! CustomInline)
case is Emphasis: return visit(emphasis: child as! Emphasis)
case is Strong: return visit(strong: child as! Strong)
case is Link: return visit(link: child as! Link)
case is Image: return visit(image: child as! Image)
case let child as Document: return visit(document: child)
case let child as BlockQuote: return visit(blockQuote: child)
case let child as List: return visit(list: child)
case let child as Item: return visit(item: child)
case let child as CodeBlock: return visit(codeBlock: child)
case let child as HtmlBlock: return visit(htmlBlock: child)
case let child as CustomBlock: return visit(customBlock: child)
case let child as Paragraph: return visit(paragraph: child)
case let child as Heading: return visit(heading: child)
case let child as ThematicBreak: return visit(thematicBreak: child)
case let child as Text: return visit(text: child)
case let child as SoftBreak: return visit(softBreak: child)
case let child as LineBreak: return visit(lineBreak: child)
case let child as Code: return visit(code: child)
case let child as HtmlInline: return visit(htmlInline: child)
case let child as CustomInline: return visit(customInline: child)
case let child as Emphasis: return visit(emphasis: child)
case let child as Strong: return visit(strong: child)
case let child as Link: return visit(link: child)
case let child as Image: return visit(image: child)
default:
assertionFailure("Unexpected child")
return nil
Expand Down

0 comments on commit fdfa661

Please sign in to comment.