Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libquassel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Janne Mareike Koschinski
libquassel
Commits
46f26732
Verified
Commit
46f26732
authored
4 years ago
by
Janne Mareike Koschinski
Browse files
Options
Downloads
Patches
Plain Diff
Properly filter invokers by side
parent
7b55d0b5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libquassel-generator/src/main/kotlin/de/justjanne/libquassel/generator/visitors/RpcModelProcessor.kt
+20
-18
20 additions, 18 deletions
...tjanne/libquassel/generator/visitors/RpcModelProcessor.kt
with
20 additions
and
18 deletions
libquassel-generator/src/main/kotlin/de/justjanne/libquassel/generator/visitors/RpcModelProcessor.kt
+
20
−
18
View file @
46f26732
...
...
@@ -97,27 +97,29 @@ class RpcModelProcessor : RpcModelVisitor<ProtocolSide, KotlinModel?> {
)
}
override
fun
visitFunctionModel
(
model
:
RpcModel
.
FunctionModel
,
data
:
ProtocolSide
)
=
KotlinModel
.
FunctionModel
(
model
.
source
,
buildCodeBlock
{
if
(
model
.
parameters
.
isEmpty
())
{
addStatement
(
"on.${model.name}()"
)
}
else
{
addStatement
(
"on.${model.name}("
)
withIndent
{
val
lastIndex
=
model
.
parameters
.
size
-
1
for
((
i
,
parameter
)
in
model
.
parameters
.
withIndex
())
{
val
suffix
=
if
(
i
!=
lastIndex
)
","
else
""
addStatement
(
"${parameter.name} = params[$i].intoOrThrow<%T>()$suffix"
,
parameter
.
type
)
override
fun
visitFunctionModel
(
model
:
RpcModel
.
FunctionModel
,
data
:
ProtocolSide
)
=
if
(
model
.
side
!=
data
)
null
else
KotlinModel
.
FunctionModel
(
model
.
source
,
buildCodeBlock
{
if
(
model
.
parameters
.
isEmpty
())
{
addStatement
(
"on.${model.name}()"
)
}
else
{
addStatement
(
"on.${model.name}("
)
withIndent
{
val
lastIndex
=
model
.
parameters
.
size
-
1
for
((
i
,
parameter
)
in
model
.
parameters
.
withIndex
())
{
val
suffix
=
if
(
i
!=
lastIndex
)
","
else
""
addStatement
(
"${parameter.name} = params[$i].intoOrThrow<%T>()$suffix"
,
parameter
.
type
)
}
}
addStatement
(
")"
)
}
addStatement
(
")"
)
}
}
)
)
override
fun
visitParameterModel
(
model
:
RpcModel
.
ParameterModel
,
data
:
ProtocolSide
):
KotlinModel
?
=
null
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment