File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/commonMain/kotlin/com/kgbier/graphql/parser Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1+ /* *
2+ * Redundant Unit returns are necessary when running in JS.
3+ * Functions which do not explicitly return a Unit value will return `undefined` in JS.
4+ */
5+ @file:Suppress(" RedundantUnitExpression" )
6+
17package com.kgbier.graphql.parser
28
39import com.kgbier.graphql.parser.structure.Maybe
410
511internal object Parsers {
612
7- val always: Parser <Unit > = Parser { }
13+ val always: Parser <Unit > = Parser { Unit }
814
915 fun <Output > always (constant : Output ): Parser <Output > = Parser { constant }
1016
@@ -62,6 +68,7 @@ internal object Parsers {
6268 val match = p(it)
6369 if (match != null ) return @Parser null
6470 }
71+ Unit
6572 }
6673
6774 val int: Parser <Int > = Parser {
@@ -90,6 +97,7 @@ internal object Parsers {
9097 fun literal (literal : String ): Parser <Unit > = Parser {
9198 if (it.startsWith(literal)) {
9299 it.advance(literal.length)
100+ Unit
93101 } else null
94102 }
95103
You can’t perform that action at this time.
0 commit comments