fixes for variable declarations
This commit is contained in:
parent
e6487369ef
commit
d12fc63571
@ -678,6 +678,7 @@ public final class Checker implements ActualParameterVisitor<FormalParameter, Vo
|
|||||||
public TypeDenoter visitDotVname(DotVname ast, Void arg) {
|
public TypeDenoter visitDotVname(DotVname ast, Void arg) {
|
||||||
ast.type = null;
|
ast.type = null;
|
||||||
var vType = ast.V.visit(this);
|
var vType = ast.V.visit(this);
|
||||||
|
ast.variable = ast.V.variable;
|
||||||
if (vType instanceof RecordTypeDenoter record) {
|
if (vType instanceof RecordTypeDenoter record) {
|
||||||
ast.type = checkFieldIdentifier(record.FT, ast.I);
|
ast.type = checkFieldIdentifier(record.FT, ast.I);
|
||||||
checkAndReportError(!ast.type.equals(StdEnvironment.errorType), "no field \"%\" in this record type",
|
checkAndReportError(!ast.type.equals(StdEnvironment.errorType), "no field \"%\" in this record type",
|
||||||
@ -695,8 +696,10 @@ public final class Checker implements ActualParameterVisitor<FormalParameter, Vo
|
|||||||
|
|
||||||
var binding = ast.I.visit(this);
|
var binding = ast.I.visit(this);
|
||||||
if (binding instanceof ConstantDeclaration constant) {
|
if (binding instanceof ConstantDeclaration constant) {
|
||||||
|
ast.variable = false;
|
||||||
return ast.type = constant.getType();
|
return ast.type = constant.getType();
|
||||||
} else if (binding instanceof VariableDeclaration variable) {
|
} else if (binding instanceof VariableDeclaration variable) {
|
||||||
|
ast.variable = true;
|
||||||
return ast.type = variable.getType();
|
return ast.type = variable.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user