reporting node rendering errors using reference to node’s token

This commit is contained in:
Ilya Puchka
2017-12-23 15:19:36 +01:00
parent 27135f3ea3
commit 53c1550c5b
15 changed files with 186 additions and 47 deletions

View File

@@ -2,7 +2,8 @@ import Spectre
import Stencil
fileprivate class CustomNode : NodeType {
fileprivate struct CustomNode : NodeType {
let token: Token?
func render(_ context:Context) throws -> String {
return "Hello World"
}
@@ -24,7 +25,7 @@ func testStencil() {
}
exampleExtension.registerTag("customtag") { parser, token in
return CustomNode()
return CustomNode(token: token)
}
let environment = Environment(extensions: [exampleExtension])