mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Try to compute the name from the contents of the string.
This commit is contained in:
parent
28ddedb967
commit
f7f45444e0
@ -85,7 +85,8 @@ func termWithInput(string: String) -> Term? {
|
||||
})
|
||||
case .Object:
|
||||
return try .Keyed(Dictionary(elements: node.namedChildren.map {
|
||||
guard let name = try $0.namedChildren.first?.name(document) else { throw E() }
|
||||
guard let range = $0.namedChildren.first?.range else { throw E() }
|
||||
guard let name = String(string.utf16[String.UTF16View.Index(_offset: range.startIndex)..<String.UTF16View.Index(_offset: range.endIndex)]) else { throw E() }
|
||||
return try (name, ($0, $0.category(document)))
|
||||
}))
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user