From 49f8e544092ad01b7425b52284480e3ba811fbe0 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 30 Oct 2015 17:21:47 -0400 Subject: [PATCH] Use a computed property. --- prototype/doubt-difftool/main.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prototype/doubt-difftool/main.swift b/prototype/doubt-difftool/main.swift index cd55f3306..6eada240c 100644 --- a/prototype/doubt-difftool/main.swift +++ b/prototype/doubt-difftool/main.swift @@ -19,14 +19,14 @@ typealias Parser = String throws -> Term struct Source { init(_ argument: String) throws { let URL = NSURL(string: argument) ?? NSURL(fileURLWithPath: argument) - guard let type = URL.pathExtension ?? URL.fragment else { throw "cannot tell the type of \(URL)" } self.URL = URL - self.type = type contents = try NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding) as String } let URL: NSURL - let type: String + var type: String { + return URL.pathExtension ?? URL.fragment ?? "" + } let contents: String private static let languagesByType: [String:TSLanguage] = [