Nullability of names
This commit is contained in:
@@ -154,7 +154,7 @@ public class ClassDescriptorResolver {
|
||||
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(
|
||||
containingDescriptor,
|
||||
AttributeResolver.INSTANCE.resolveAttributes(function.getModifierList()),
|
||||
function.getName()
|
||||
safeName(function.getName())
|
||||
);
|
||||
WritableScope parameterScope = semanticServices.createWritableScope(scope, functionDescriptor);
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ public class TopDownAnalyzer {
|
||||
|
||||
@Override
|
||||
public void visitDeclaration(JetDeclaration dcl) {
|
||||
throw new UnsupportedOperationException(dcl.getText() + " " + dcl.getClass().getCanonicalName()); // TODO
|
||||
semanticServices.getErrorHandler().genericError(dcl.getNode(), "Unsupported declaration: " + dcl); // TODO
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements
|
||||
public FunctionDescriptorImpl(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull List<Attribute> attributes,
|
||||
String name) {
|
||||
@NotNull String name) {
|
||||
super(containingDeclaration, attributes, name);
|
||||
this.original = this;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements
|
||||
public FunctionDescriptorImpl(
|
||||
@NotNull FunctionDescriptor original,
|
||||
@NotNull List<Attribute> attributes,
|
||||
String name) {
|
||||
@NotNull String name) {
|
||||
super(original.getContainingDeclaration(), attributes, name);
|
||||
this.original = original;
|
||||
}
|
||||
|
||||
@@ -275,16 +275,18 @@ public class JetTypeInferrer {
|
||||
private JetType getBlockReturnedType(@NotNull JetScope outerScope, List<JetElement> block) {
|
||||
if (block.isEmpty()) {
|
||||
return JetStandardClasses.getUnitType();
|
||||
} else {
|
||||
DeclarationDescriptor containingDescriptor = outerScope.getContainingDeclaration();
|
||||
WritableScope scope = semanticServices.createWritableScope(outerScope, containingDescriptor);
|
||||
return getBlockReturnedTypeWithWritableScope(scope, block);
|
||||
}
|
||||
|
||||
DeclarationDescriptor containingDescriptor = outerScope.getContainingDeclaration();
|
||||
WritableScope scope = semanticServices.createWritableScope(outerScope, containingDescriptor);
|
||||
return getBlockReturnedTypeWithWritableScope(scope, block);
|
||||
}
|
||||
|
||||
private JetType getBlockReturnedTypeWithWritableScope(@NotNull WritableScope scope, @NotNull List<? extends JetElement> block) {
|
||||
assert !block.isEmpty();
|
||||
|
||||
TypeInferrerVisitorWithWritableScope blockLevelVisitor = new TypeInferrerVisitorWithWritableScope(scope, true);
|
||||
|
||||
JetType result = null;
|
||||
for (JetElement statement : block) {
|
||||
result = blockLevelVisitor.getType((JetExpression) statement);
|
||||
@@ -345,6 +347,8 @@ public class JetTypeInferrer {
|
||||
result = null;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
// TODO : other members
|
||||
|
||||
Reference in New Issue
Block a user