Skip to content

Commit

Permalink
Fix specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenamar-db committed Dec 31, 2024
1 parent 2d317f6 commit fb9f800
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sjsonnet/src/sjsonnet/Std.scala
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,9 @@ class Std(private val additionalNativeFunctions: Map[String, Val.Builtin] = Map.
case _ => null
}
private class SpecFrom(from: String) extends Val.Builtin2("strReplaceAll", "str", "to") {
private[this] val pattern = Platform.getPatternFromCache(from)
def evalRhs(str: Val, to: Val, ev: EvalScope, pos: Position): Val =
Val.Str(pos, Platform.getPatternFromCache(from).matcher(str.asString).replaceAll(to.asString))
Val.Str(pos, pattern.matcher(str.asString).replaceAll(to.asString))
}
}

Expand Down

0 comments on commit fb9f800

Please sign in to comment.