Name class

In the most places in frontend identifier is stored in Name class, was in String.
Name has two advantages over String:
* validation: you cannot accidentally create identifier with dot, for example
* readability: if you see String, you don't now whether it is
  identifier, fq name, jvm class name or something else

Name's disadvantage is (small) performance overhead. We have no value types in JVM.
This commit is contained in:
Stepan Koltsov
2012-05-23 02:52:32 +04:00
parent c15ff2dee0
commit 33a59ff5fe
152 changed files with 962 additions and 726 deletions
@@ -40,6 +40,7 @@ import org.jetbrains.jet.lang.psi.JetPsiUtil;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.plugin.JetLanguage;
import org.jetbrains.jet.plugin.JetMainDetector;
import org.jetbrains.jet.utils.Progress;
@@ -127,7 +128,7 @@ public class KotlinToJVMBytecodeCompiler {
for (JetFile file : configuration.getEnvironment().getSourceFiles()) {
if (JetMainDetector.hasMain(file.getDeclarations())) {
FqName fqName = JetPsiUtil.getFQName(file);
mainClass = fqName.child(JvmAbi.PACKAGE_CLASS);
mainClass = fqName.child(Name.identifier(JvmAbi.PACKAGE_CLASS));
break;
}
}