Fixe Type Error
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
parent
c315966219
commit
1de6add080
@ -14,7 +14,6 @@ public class ConstructorNode extends MethodNode implements Visitable {
|
||||
public AccessModifierNode accessType;
|
||||
public String identifier;
|
||||
public List<ParameterNode> parameters = new ArrayList<>();
|
||||
public BlockNode block;
|
||||
|
||||
public ConstructorNode(String accessType, String identifier, BlockNode block) {
|
||||
this.accessType = new AccessModifierNode(accessType);
|
||||
|
@ -114,10 +114,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
||||
|
||||
@Override
|
||||
public TypeCheckResult analyze(MethodNode methodNode) {
|
||||
if (methodNode instanceof ConstructorNode) {
|
||||
return new TypeCheckResult(true, new BaseType(TypeEnum.VOID));
|
||||
} else {
|
||||
|
||||
var valid = true;
|
||||
|
||||
for (var otherMethod : currentClass.getMethods()) {
|
||||
@ -159,8 +155,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
||||
}
|
||||
|
||||
return new TypeCheckResult(valid, resultType);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -177,8 +171,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
||||
currentFields.put(toCheck.identifier, toCheck.type);
|
||||
}
|
||||
return new TypeCheckResult(true, null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,8 +1,8 @@
|
||||
class Null{
|
||||
|
||||
Null a;
|
||||
int a;
|
||||
|
||||
public Null(){
|
||||
this.a = null;
|
||||
this.a = 1;
|
||||
}
|
||||
}
|
@ -1,16 +1,8 @@
|
||||
public class Compiler {
|
||||
Node node;
|
||||
public int add(int i, int j) {
|
||||
node = new Node();
|
||||
node.x = 1;
|
||||
return i+j;
|
||||
}
|
||||
}
|
||||
|
||||
public class Node {
|
||||
public int x;
|
||||
public void main() {
|
||||
Compiler compiler = new Compiler();
|
||||
int i = compiler.add(5, 8);
|
||||
public class If {
|
||||
public If() {
|
||||
int intValue = 5;
|
||||
if(intValue == 5) {
|
||||
intValue--;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user