Skip to content

Commit

Permalink
refactor(provider): Rename ShireProvideType enum values and variables #…
Browse files Browse the repository at this point in the history
…112

Update the ShireProvideType enum to use plural forms for consistency.
Rename local variable gitFunc to shireFunc for clarity.
  • Loading branch information
phodal committed Sep 30, 2024
1 parent f3555d3 commit c80cecd
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.phodal.shirelang.compiler.patternaction.PatternActionFunc
import com.phodal.shirelang.compiler.variable.CompositeVariableProvider

enum class ShireProvideType(val type: String) {
Variable("variable"),
Function("function"),
Variables("variables"),
Functions("functions"),
Lifecycle("lifecycle")
;

Expand Down Expand Up @@ -38,18 +38,18 @@ class ShireToolchainFunctionProvider : ToolchainFunctionProvider {
}

override fun execute(project: Project, funcName: String, args: List<Any>, allVariables: Map<String, Any?>): Any {
val gitFunc = ShireToolchainFunction.fromString(funcName)
val shireFunc = ShireToolchainFunction.fromString(funcName)
?: throw IllegalArgumentException("Shire[Toolchain]: Invalid Toolchain function name")

return when (gitFunc) {
when (shireFunc) {
ShireToolchainFunction.Provider -> {
val type = args.first() as String
when (ShireProvideType.fromString(type)) {
ShireProvideType.Variable -> {
return when (ShireProvideType.fromString(type)) {
ShireProvideType.Variables -> {
CompositeVariableProvider.all()
}

ShireProvideType.Function -> {
ShireProvideType.Functions -> {
PatternActionFunc.all()
}

Expand Down

0 comments on commit c80cecd

Please sign in to comment.