remove validation from Name.identifier
This commit is contained in:
@@ -85,7 +85,7 @@ abstract class JetNamedDeclarationStub<T extends KotlinStubWithFqName<?>> extend
|
||||
JetModifierList modifierList = getModifierList();
|
||||
if (modifierList != null &&
|
||||
modifierList.hasModifier(JetTokens.OPERATOR_KEYWORD) &&
|
||||
!OperatorConventions.isConventionName(Name.identifierNoValidate(name))) {
|
||||
!OperatorConventions.isConventionName(Name.identifier(name))) {
|
||||
removeModifier(JetTokens.OPERATOR_KEYWORD);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ abstract class JetSimpleNameExpressionImpl(node: ASTNode) : JetExpressionImpl(no
|
||||
|
||||
fun getReferencedNameAsNameImpl(expresssion: JetSimpleNameExpression): Name {
|
||||
val name = expresssion.getReferencedName()
|
||||
return Name.identifierNoValidate(name)
|
||||
return Name.identifier(name)
|
||||
}
|
||||
|
||||
fun getReferencedNameImpl(expression: JetSimpleNameExpression): String {
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ public class ControlStructureTypingUtils {
|
||||
) {
|
||||
assert argumentNames.size() == isArgumentNullable.size();
|
||||
|
||||
Name specialFunctionName = Name.identifierNoValidate("<SPECIAL-FUNCTION-FOR-" + constructionName + "-RESOLVE>");
|
||||
Name specialFunctionName = Name.identifier("<SPECIAL-FUNCTION-FOR-" + constructionName + "-RESOLVE>");
|
||||
|
||||
SimpleFunctionDescriptorImpl function = SimpleFunctionDescriptorImpl.create(
|
||||
moduleDescriptor, Annotations.Companion.getEMPTY(), specialFunctionName, CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE
|
||||
@@ -108,7 +108,7 @@ public class ControlStructureTypingUtils {
|
||||
|
||||
TypeParameterDescriptor typeParameter = TypeParameterDescriptorImpl.createWithDefaultBound(
|
||||
function, Annotations.Companion.getEMPTY(), false, Variance.INVARIANT,
|
||||
Name.identifierNoValidate("<TYPE-PARAMETER-FOR-" + constructionName + "-RESOLVE>"), 0);
|
||||
Name.identifier("<TYPE-PARAMETER-FOR-" + constructionName + "-RESOLVE>"), 0);
|
||||
|
||||
JetType type = typeParameter.getDefaultType();
|
||||
JetType nullableType = TypeUtils.makeNullable(type);
|
||||
|
||||
@@ -52,9 +52,6 @@ public final class Name implements Comparable<Name> {
|
||||
|
||||
@NotNull
|
||||
public static Name identifier(@NotNull String name) {
|
||||
if (!isValidIdentifier(name)) {
|
||||
throw new IllegalArgumentException("invalid identifier: " + name);
|
||||
}
|
||||
return new Name(name, false);
|
||||
}
|
||||
|
||||
@@ -62,12 +59,6 @@ public final class Name implements Comparable<Name> {
|
||||
return !name.isEmpty() && !name.startsWith("<") && !name.contains(".") && !name.contains("/");
|
||||
}
|
||||
|
||||
/** Must be validated by caller */
|
||||
@NotNull
|
||||
public static Name identifierNoValidate(@NotNull String name) {
|
||||
return new Name(name, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Name special(@NotNull String name) {
|
||||
if (!name.startsWith("<")) {
|
||||
|
||||
+3
-3
@@ -137,7 +137,7 @@ private fun getCallNameFromPsi(element: JetElement): Name? {
|
||||
is JetSimpleNameExpression -> {
|
||||
val elementParent = element.getParent()
|
||||
when (elementParent) {
|
||||
is JetCallExpression -> return Name.identifierNoValidate(element.getText())
|
||||
is JetCallExpression -> return Name.identifier(element.getText())
|
||||
is JetOperationExpression -> {
|
||||
val operationReference = elementParent.getOperationReference()
|
||||
if (element == operationReference) {
|
||||
@@ -148,10 +148,10 @@ private fun getCallNameFromPsi(element: JetElement): Name? {
|
||||
else
|
||||
OperatorConventions.getNameForOperationSymbol(node)
|
||||
|
||||
conventionName ?: Name.identifierNoValidate(element.getText())
|
||||
conventionName ?: Name.identifier(element.getText())
|
||||
}
|
||||
else {
|
||||
Name.identifierNoValidate(element.getText())
|
||||
Name.identifier(element.getText())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user