Skip to content

Commit

Permalink
added Ast.astInfoOrNull helper refs #21
Browse files Browse the repository at this point in the history
  • Loading branch information
drieks committed Dec 17, 2020
1 parent fe958fe commit 8cef2d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ interface AstWithAstInfo : AstWithAttachments {
}
}

val Ast.astInfoOrNull: AstInfo?
get() {
return if (this is AstWithAstInfo) {
info
} else {
null
}
}

interface AstSelfTypedWithAstInfo<Self> : AstSelfTypedWithAttachments<Self>, AstWithAstInfo
where Self : AstSelfTypedWithAttachments<Self>, Self : AstWithAstInfo {
override fun withAstInfo(info: AstInfo?): Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface AstWithRawAst : AstWithAttachments {
}
}

fun Ast.rawOrNull(): RawAst? {
fun Ast.rawAstOrNull(): RawAst? {
return if(this is AstWithRawAst) {
raw
} else {
Expand Down

0 comments on commit 8cef2d8

Please sign in to comment.