mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 17:48:03 +00:00
minor generator changes
This commit is contained in:
parent
c2ce7ff80f
commit
535c712421
@ -37,16 +37,13 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
|||||||
@Override
|
@Override
|
||||||
public Expression visitExpression(DecafParser.ExpressionContext ctx) {
|
public Expression visitExpression(DecafParser.ExpressionContext ctx) {
|
||||||
//ParseTree for ( expr )
|
//ParseTree for ( expr )
|
||||||
//Just pass it down to the inner expr:
|
// pass it down to the inner expr:
|
||||||
return this.visit(ctx.expr());
|
return this.visit(ctx.expr());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expression visitIdentifier(DecafParser.IdentifierContext ctx){
|
public Expression visitIdentifier(DecafParser.IdentifierContext ctx){
|
||||||
Boolean isField = false;
|
boolean isField = ctx.fieldId().THIS() != null;
|
||||||
if(ctx.fieldId().THIS() != null){
|
|
||||||
isField = true;
|
|
||||||
}
|
|
||||||
Expression recipient = null;
|
Expression recipient = null;
|
||||||
if(ctx.fieldId().recipient() != null){
|
if(ctx.fieldId().recipient() != null){
|
||||||
List<DecafParser.RecipientContext> recipientList = ctx.fieldId().recipient();
|
List<DecafParser.RecipientContext> recipientList = ctx.fieldId().recipient();
|
||||||
@ -89,10 +86,7 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expression visitMethodCall(DecafParser.MethodCallContext ctx) {
|
public Expression visitMethodCall(DecafParser.MethodCallContext ctx) {
|
||||||
Boolean isField = false;
|
boolean isField = ctx.methCall().THIS() != null;
|
||||||
if(ctx.methCall().THIS() != null){
|
|
||||||
isField = true;
|
|
||||||
}
|
|
||||||
Expression recipient = null;
|
Expression recipient = null;
|
||||||
if(ctx.methCall().recipient() != null){
|
if(ctx.methCall().recipient() != null){
|
||||||
List<DecafParser.RecipientContext> recipientList = ctx.methCall().recipient();
|
List<DecafParser.RecipientContext> recipientList = ctx.methCall().recipient();
|
||||||
|
@ -77,14 +77,11 @@ public class StatementGenerator extends DecafBaseVisitor<Statement> {
|
|||||||
//StatementExpression
|
//StatementExpression
|
||||||
@Override
|
@Override
|
||||||
public Statement visitMethodCall(DecafParser.MethodCallContext ctx) {
|
public Statement visitMethodCall(DecafParser.MethodCallContext ctx) {
|
||||||
Boolean isField = false;
|
boolean isField = ctx.methCall().THIS() != null;
|
||||||
if(ctx.methCall().THIS() != null){
|
|
||||||
isField = true;
|
|
||||||
}
|
|
||||||
Expression recipient = null;
|
Expression recipient = null;
|
||||||
if(ctx.methCall().recipient() != null){
|
if(ctx.methCall().recipient() != null){
|
||||||
List<DecafParser.RecipientContext> recipientList = ctx.methCall().recipient();
|
List<DecafParser.RecipientContext> recipientList = ctx.methCall().recipient();
|
||||||
recipient = new ExpressionGenerator().generateRecipient(recipientList, null);
|
recipient = ExpressionGenerator.generateRecipient(recipientList, null);
|
||||||
}
|
}
|
||||||
Id id = new Id(ctx.methCall().methName().id().getText());
|
Id id = new Id(ctx.methCall().methName().id().getText());
|
||||||
List<Expression> args = new ArrayList<>();
|
List<Expression> args = new ArrayList<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user