added MemberAccess to Assignable
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
3996082fa7
commit
f7338a06b3
@ -50,7 +50,7 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
|
|||||||
@Override
|
@Override
|
||||||
public void visit(ConstructorNode constructorNode) {
|
public void visit(ConstructorNode constructorNode) {
|
||||||
methodVisitor =
|
methodVisitor =
|
||||||
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accessType),
|
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accesModifier),
|
||||||
"<init>",
|
"<init>",
|
||||||
mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters),
|
mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters),
|
||||||
null,
|
null,
|
||||||
|
@ -246,6 +246,9 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
if (currentFields.get(toCheck.identifier) != null) {
|
if (currentFields.get(toCheck.identifier) != null) {
|
||||||
var type = currentFields.get(toCheck.identifier);
|
var type = currentFields.get(toCheck.identifier);
|
||||||
toCheck.setTypeNode(type);
|
toCheck.setTypeNode(type);
|
||||||
|
MemberAccessNode memberAccessNode = new MemberAccessNode(false);
|
||||||
|
memberAccessNode.identifiers.add(currentClass.identifier);
|
||||||
|
toCheck.memberAccess = memberAccessNode;
|
||||||
return new TypeCheckResult(true, type);
|
return new TypeCheckResult(true, type);
|
||||||
} else if (currentScope.getLocalVar(toCheck.identifier) != null) {
|
} else if (currentScope.getLocalVar(toCheck.identifier) != null) {
|
||||||
var type = currentScope.getLocalVar(toCheck.identifier);
|
var type = currentScope.getLocalVar(toCheck.identifier);
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
// @expected: TypeMismatchException
|
||||||
|
public class AllFeaturesClassExample {
|
||||||
|
int x;
|
||||||
|
|
||||||
|
public boolean test(boolean x){
|
||||||
|
return this.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,8 +2,8 @@
|
|||||||
public class AllFeaturesClassExample {
|
public class AllFeaturesClassExample {
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
public boolean test(boolean x){
|
public void test(){
|
||||||
return x;
|
x = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user