godot.entrygenerator.checks.PropertyMutablilityCheck.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of godot-entry-generator Show documentation
Show all versions of godot-entry-generator Show documentation
Godot Kotlin entry code generator.
package godot.entrygenerator.checks
import godot.entrygenerator.model.RegisterPropertyAnnotation
import godot.entrygenerator.model.SourceFile
import godot.entrygenerator.utils.Logger
class PropertyMutablilityCheck(logger: Logger, sourceFiles: List): BaseCheck(logger, sourceFiles) {
override fun execute(): Boolean {
var hasIssue = false
sourceFiles
.flatMap { it.registeredClasses }
.flatMap { it.properties }
.filter { registeredProperty -> registeredProperty.annotations.filterIsInstance().isNotEmpty() }
.forEach { registeredProperty ->
if (!registeredProperty.isMutable) {
hasIssue = true
logger.error(registeredProperty, "Registered property is not mutable")
}
}
return hasIssue
}
}