Skip to content

Commit e401cc4

Browse files
authored
Add Binding argument in CalculatedTimeSeriesGroovyDslLoader.load (#3664)
Signed-off-by: Matthieu SAUR <[email protected]>
1 parent bae8522 commit e401cc4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

time-series/time-series-dsl/src/main/groovy/com/powsybl/timeseries/dsl/CalculatedTimeSeriesGroovyDslLoader.groovy

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,11 @@ class CalculatedTimeSeriesGroovyDslLoader implements CalculatedTimeSeriesDslLoad
127127
config.addCompilationCustomizers(new ASTTransformationCustomizer(ThreadInterrupt.class))
128128
}
129129

130-
public Map<String, NodeCalc> load(String script, ReadOnlyTimeSeriesStore store) {
130+
static Map<String, NodeCalc> load(Binding binding, String script, ReadOnlyTimeSeriesStore store) {
131131
long start = System.currentTimeMillis()
132132

133133
Map<String, NodeCalc> nodes = new HashMap<>()
134134

135-
Binding binding = new Binding()
136135
bind(binding, store, nodes)
137136

138137
def shell = new GroovyShell(binding, createCompilerConfig())
@@ -150,5 +149,10 @@ class CalculatedTimeSeriesGroovyDslLoader implements CalculatedTimeSeriesDslLoad
150149
LOGGER.trace("Check for duplication done in {} ms", (System.currentTimeMillis() -start))
151150

152151
nodes
152+
153+
}
154+
155+
Map<String, NodeCalc> load(String script, ReadOnlyTimeSeriesStore store) {
156+
load(new Binding(), script, store)
153157
}
154158
}

0 commit comments

Comments
 (0)