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:
@@ -26,6 +26,7 @@ import org.jetbrains.jet.j2k.ast.Class;
|
||||
import org.jetbrains.jet.j2k.ast.Enum;
|
||||
import org.jetbrains.jet.j2k.util.AstUtil;
|
||||
import org.jetbrains.jet.j2k.visitors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
||||
|
||||
import java.util.*;
|
||||
@@ -781,7 +782,7 @@ public class Converter {
|
||||
|
||||
@NotNull
|
||||
private static String getPrimitiveTypeConversion(@NotNull String type) {
|
||||
Map<String, String> conversions = new HashMap<String, String>();
|
||||
Map<String, Name> conversions = new HashMap<String, Name>();
|
||||
conversions.put("byte", BYTE);
|
||||
conversions.put("short", SHORT);
|
||||
conversions.put("int", INT);
|
||||
|
||||
@@ -62,7 +62,7 @@ public class TypeVisitor extends PsiTypeVisitor<Type> implements J2KVisitor {
|
||||
final IdentifierImpl identifier = new IdentifierImpl(name);
|
||||
|
||||
if (name.equals("void")) {
|
||||
myResult = new PrimitiveType(new IdentifierImpl(JetStandardClasses.UNIT_ALIAS));
|
||||
myResult = new PrimitiveType(new IdentifierImpl(JetStandardClasses.UNIT_ALIAS.getName()));
|
||||
}
|
||||
else if (Node.PRIMITIVE_TYPES.contains(name)) {
|
||||
myResult = new PrimitiveType(new IdentifierImpl(AstUtil.upperFirstCharacter(name)));
|
||||
|
||||
Reference in New Issue
Block a user