All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jtransc.plugin.enum.EnumJTranscPlugin.kt Maven / Gradle / Ivy

Go to download

JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.

There is a newer version: 0.6.8
Show newest version
package com.jtransc.plugin.enum

import com.jtransc.ast.*
import com.jtransc.ast.treeshaking.TreeShakingApi
import com.jtransc.plugin.JTranscPlugin

/**
 * Plugin that include values() method from enums
 */
class EnumJTranscPlugin : JTranscPlugin() {
	override fun onTreeShakingAddBasicClass(treeShaking: TreeShakingApi, fqname: FqName, oldclass: AstClass, newclass: AstClass) {
		if (oldclass.modifiers.isEnum) {
			treeShaking.addMethod(AstMethodRef(fqname, "values", AstType.METHOD(ARRAY(oldclass.astType), listOf())), "EnumJTranscPlugin")
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy