1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Explicitly annotate types so we can call without extra parentheses.

This commit is contained in:
Rob Rix 2015-09-23 12:32:25 -04:00
parent 22fa931d4d
commit bd7bcaea00
2 changed files with 6 additions and 6 deletions

View File

@ -25,12 +25,12 @@ public enum Term: CustomDebugStringConvertible, CustomDocConvertible, CustomStri
}
public static let Apply = Syntax.Apply >>> Roll
public static let Abstract = Syntax.Abstract >>> Roll
public static let Assign = Syntax.Assign >>> Roll
public static let Apply: (Term, [Term]) -> Term = Syntax.Apply >>> Roll
public static let Abstract: ([Term], [Term]) -> Term = Syntax.Abstract >>> Roll
public static let Assign: (String, Term) -> Term = Syntax.Assign >>> Roll
public static let Variable = Syntax.Variable >>> Roll
public static let Literal = Syntax.Literal >>> Roll
public static let Group = Syntax.Group >>> Roll
public static let Group: (Term, [Term]) -> Term = Syntax.Group >>> Roll
}
public enum Syntax<Payload>: CustomDebugStringConvertible, CustomDocConvertible {

View File

@ -30,10 +30,10 @@ extension Term {
let substructure = d["key.substructure"]?.array ?? []
switch d["key.kind"]?.string {
case .Some("source.lang.swift.decl.class"), .Some("source.lang.swift.decl.extension"):
self = .Group((.Literal(name), substructure.map(Term.init)))
self = .Group(.Literal(name), substructure.map(Term.init))
case .Some("source.lang.swift.decl.function.method.instance"), .Some("source.lang.swift.decl.function.free"):
self = .Assign((name, .Abstract(([], substructure.map(Term.init)))))
self = .Assign(name, .Abstract([], substructure.map(Term.init)))
default:
self = .Empty