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