File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -680,15 +680,15 @@ class Evaluator(
680
680
visitExpr(k) match {
681
681
case Val .Str (_, k1) => k1
682
682
case Val .Null (_) => null
683
- case x =>
684
- Error .fail(
685
- s " Field name must be string or null, not ${x.prettyName}" ,
686
- pos
687
- )
683
+ case x => fieldNameTypeError(x, pos)
688
684
}
689
685
}
690
686
}
691
687
688
+ private def fieldNameTypeError (fieldName : Val , pos : Position ): Nothing = {
689
+ Error .fail(s " Field name must be string or null, not ${fieldName.prettyName}" , pos)
690
+ }
691
+
692
692
def visitMethod (rhs : Expr , params : Params , outerPos : Position )(implicit
693
693
scope : ValScope ): Val .Func =
694
694
new Val .Func (outerPos, scope, params) {
@@ -856,11 +856,7 @@ class Evaluator(
856
856
Error .fail(s " Duplicate key ${k} in evaluated object comprehension. " , e.pos);
857
857
}
858
858
case Val .Null (_) => // do nothing
859
- case x =>
860
- Error .fail(
861
- s " Field name must be string or null, not ${x.prettyName}" ,
862
- e.pos
863
- )
859
+ case x => fieldNameTypeError(x, e.pos)
864
860
}
865
861
}
866
862
val valueCache = if (sup == null ) {
You can’t perform that action at this time.
0 commit comments