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(
680680 visitExpr(k) match {
681681 case Val .Str (_, k1) => k1
682682 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)
688684 }
689685 }
690686 }
691687
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+
692692 def visitMethod (rhs : Expr , params : Params , outerPos : Position )(implicit
693693 scope : ValScope ): Val .Func =
694694 new Val .Func (outerPos, scope, params) {
@@ -856,11 +856,7 @@ class Evaluator(
856856 Error .fail(s " Duplicate key ${k} in evaluated object comprehension. " , e.pos);
857857 }
858858 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)
864860 }
865861 }
866862 val valueCache = if (sup == null ) {
You can’t perform that action at this time.
0 commit comments