Skip to content

Commit e8ad2b2

Browse files
committed
chore: renamed methods in INodeResolutionScope
The names where hard to understand. Not a breaking change, because the previous names aren't released yet.
1 parent a4053e2 commit e8ad2b2

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

model-api/src/commonMain/kotlin/org/modelix/model/api/INodeResolutionScope.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ interface INodeResolutionScope {
2020
* All node references inside the body are resolved against this scope. Compared to runWithAlso, the existing scopes
2121
* in the current context are not used, meaning they are replaced.
2222
*/
23-
fun <T> runWithOnly(body: () -> T): T = contextScope.computeWith(this, body)
23+
fun <T> runWith(body: () -> T): T = contextScope.computeWith(this, body)
2424

2525
/**
2626
* Does the same as runWithOnly, but with support for suspendable functions.
2727
*/
28-
suspend fun <T> runWithOnlyInCoroutine(body: suspend () -> T): T = contextScope.runInCoroutine(this, body)
28+
suspend fun <T> runWithInCoroutine(body: suspend () -> T): T = contextScope.runInCoroutine(this, body)
2929

3030
/**
3131
* All node references inside the body are resolved against this scope and if that fails against any other scope in
3232
* the current context.
3333
*/
34-
fun <T> runWithAlso(body: () -> T): T = runWithAlso(this, body)
34+
fun <T> runWithAdditionalScope(body: () -> T): T = runWithAdditionalScope(this, body)
3535

3636
/**
3737
* Does the same as runWithAlso, but with support for suspendable functions.
3838
*/
39-
suspend fun <T> runWithAlsoInCoroutine(body: suspend () -> T): T = runWithAlsoInCoroutine(this, body)
39+
suspend fun <T> runWithAdditionalScopeInCoroutine(body: suspend () -> T): T = runWithAdditionalScopeInCoroutine(this, body)
4040

4141
companion object {
4242
internal val contextScope = ContextValue<INodeResolutionScope>()
@@ -45,7 +45,7 @@ interface INodeResolutionScope {
4545
return listOf(scopeToAdd) + (getCurrentScopes() - scopeToAdd)
4646
}
4747

48-
fun <T> runWithAlso(scope: INodeResolutionScope, body: () -> T): T {
48+
fun <T> runWithAdditionalScope(scope: INodeResolutionScope, body: () -> T): T {
4949
val newScopes = combineScopes(scope)
5050
return when (newScopes.size) {
5151
0 -> throw RuntimeException("Impossible case")
@@ -54,7 +54,7 @@ interface INodeResolutionScope {
5454
}
5555
}
5656

57-
suspend fun <T> runWithAlsoInCoroutine(scope: INodeResolutionScope, body: suspend () -> T): T {
57+
suspend fun <T> runWithAdditionalScopeInCoroutine(scope: INodeResolutionScope, body: suspend () -> T): T {
5858
val newScopes = combineScopes(scope)
5959
return when (newScopes.size) {
6060
0 -> throw RuntimeException("Impossible case")
@@ -90,7 +90,7 @@ interface INodeResolutionScope {
9090
return if (current.contains(scope)) {
9191
body()
9292
} else {
93-
scope.runWithAlso(body)
93+
scope.runWithAdditionalScope(body)
9494
}
9595
}
9696
}

model-api/src/commonMain/kotlin/org/modelix/model/area/ContextArea.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ object ContextArea {
3030

3131
@Deprecated("use INodeResolutionScope.runWithAdditional() or area.runWithAdditional")
3232
fun <T> withAdditionalContext(area: IArea, runnable: () -> T): T {
33-
return INodeResolutionScope.runWithAlso(area, runnable)
33+
return INodeResolutionScope.runWithAdditionalScope(area, runnable)
3434
}
3535

3636
@Deprecated("use INodeResolutionScope.offer")
3737
fun <T> offer(area: IArea, r: () -> T): T {
3838
val current = getArea()
3939
return if (current == null || !current.collectAreas().contains(area)) {
40-
area.runWithOnly(r)
40+
area.runWith(r)
4141
} else {
4242
r()
4343
}

modelql-client/src/commonMain/kotlin/org/modelix/modelql/client/ModelQLClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ModelQLClient(val url: String, val client: HttpClient, includedSerializers
5858
}
5959

6060
protected fun <T> deserialize(serializedJson: String, query: IUnboundQuery<*, T, *>): T {
61-
return ModelQLArea(this).runWithAlso {
61+
return ModelQLArea(this).runWithAdditionalScope {
6262
VersionAndData.deserialize(
6363
serializedJson,
6464
query.getAggregationOutputSerializer(json.serializersModule),

modelql-server/src/main/kotlin/org/modelix/modelql/server/ModelQLServer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ModelQLServer private constructor(val rootNodeProvider: () -> INode?, val
8484
LOG.debug { "query: $query" }
8585
val transactionBody: () -> IStepOutput<Any?> = {
8686
runBlocking {
87-
area.runWithAlsoInCoroutine {
87+
area.runWithAdditionalScopeInCoroutine {
8888
query.bind(rootNode.createQueryExecutor()).execute()
8989
}
9090
}

0 commit comments

Comments
 (0)