提交 6f3b9fe3 编写于 作者: A Andrey Breslav

Cleanup

上级 fde6a6f6
...@@ -513,26 +513,34 @@ public class JetTypeInferrer { ...@@ -513,26 +513,34 @@ public class JetTypeInferrer {
result = standardLibrary.getIntType(); result = standardLibrary.getIntType();
} }
// TODO : other ranges // TODO : other ranges
} else if (elementType == JetNodeTypes.LONG_CONSTANT) { }
else if (elementType == JetNodeTypes.LONG_CONSTANT) {
result = standardLibrary.getLongType(); result = standardLibrary.getLongType();
} else if (elementType == JetNodeTypes.FLOAT_CONSTANT) { }
else if (elementType == JetNodeTypes.FLOAT_CONSTANT) {
String text = expression.getText(); String text = expression.getText();
assert text.length() > 0; assert text.length() > 0;
char lastChar = text.charAt(text.length() - 1); char lastChar = text.charAt(text.length() - 1);
if (lastChar == 'f' || lastChar == 'F') { if (lastChar == 'f' || lastChar == 'F') {
result = standardLibrary.getFloatType(); result = standardLibrary.getFloatType();
} else { }
else {
result = standardLibrary.getDoubleType(); result = standardLibrary.getDoubleType();
} }
} else if (elementType == JetNodeTypes.BOOLEAN_CONSTANT) { }
else if (elementType == JetNodeTypes.BOOLEAN_CONSTANT) {
result = standardLibrary.getBooleanType(); result = standardLibrary.getBooleanType();
} else if (elementType == JetNodeTypes.CHARACTER_CONSTANT) { }
else if (elementType == JetNodeTypes.CHARACTER_CONSTANT) {
result = standardLibrary.getCharType(); result = standardLibrary.getCharType();
} else if (elementType == JetNodeTypes.STRING_CONSTANT) { }
else if (elementType == JetNodeTypes.STRING_CONSTANT) {
result = standardLibrary.getStringType(); result = standardLibrary.getStringType();
} else if (elementType == JetNodeTypes.NULL) { }
else if (elementType == JetNodeTypes.NULL) {
result = JetStandardClasses.getNullableNothingType(); result = JetStandardClasses.getNullableNothingType();
} else { }
else {
throw new IllegalArgumentException("Unsupported constant: " + expression); throw new IllegalArgumentException("Unsupported constant: " + expression);
} }
} }
...@@ -546,12 +554,8 @@ public class JetTypeInferrer { ...@@ -546,12 +554,8 @@ public class JetTypeInferrer {
public void visitReturnExpression(JetReturnExpression expression) { public void visitReturnExpression(JetReturnExpression expression) {
JetExpression returnedExpression = expression.getReturnedExpression(); JetExpression returnedExpression = expression.getReturnedExpression();
JetType returnedType;
if (returnedExpression != null) { if (returnedExpression != null) {
returnedType = getType(scope, returnedExpression, false); getType(scope, returnedExpression, false);
}
else {
returnedType = JetStandardClasses.getUnitType();
} }
result = JetStandardClasses.getNothingType(); result = JetStandardClasses.getNothingType();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册