Skip to content

Commit 5c6aafd

Browse files
SB-31: Translation Issues
2 parents 73ecf91 + c242423 commit 5c6aafd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+533
-66
lines changed

release/snips.exe

12.7 KB
Binary file not shown.

release/snips.jar

12.7 KB
Binary file not shown.

res/Test/Value/Interfaces/test_13.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct A<K> : GetSet<K> {
1818
return self->val;
1919
}
2020

21-
K set<K>(K val) {
21+
void set<K>(K val) {
2222
self->val = val;
2323
}
2424
}

src/Ctx/ContextChecker.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
import Imm.AST.Statement.AssignWriteback;
5050
import Imm.AST.Statement.Assignment;
5151
import Imm.AST.Statement.Assignment.ASSIGN_ARITH;
52+
import Imm.AST.Typedef.InterfaceTypedef;
53+
import Imm.AST.Typedef.StructTypedef;
5254
import Imm.AST.Statement.BreakStatement;
5355
import Imm.AST.Statement.CaseStatement;
5456
import Imm.AST.Statement.CompoundStatement;
@@ -61,11 +63,9 @@
6163
import Imm.AST.Statement.ForStatement;
6264
import Imm.AST.Statement.FunctionCall;
6365
import Imm.AST.Statement.IfStatement;
64-
import Imm.AST.Statement.InterfaceTypedef;
6566
import Imm.AST.Statement.ReturnStatement;
6667
import Imm.AST.Statement.SignalStatement;
6768
import Imm.AST.Statement.Statement;
68-
import Imm.AST.Statement.StructTypedef;
6969
import Imm.AST.Statement.SwitchStatement;
7070
import Imm.AST.Statement.TryStatement;
7171
import Imm.AST.Statement.WatchStatement;
@@ -351,7 +351,6 @@ public TYPE checkFunction(Function f) throws CTX_EXC {
351351
}
352352

353353
public TYPE checkStructTypedef(StructTypedef e) throws CTX_EXC {
354-
355354
/* Make sure at least one field is in the struct */
356355
if (e.getFields().isEmpty())
357356
throw new CTX_EXC(e.getSource(), Const.STRUCT_TYPEDEF_MUST_CONTAIN_FIELD);
@@ -428,7 +427,9 @@ public TYPE checkStructTypedef(StructTypedef e) throws CTX_EXC {
428427

429428
for (Function f : inter.getTypedef().functions) {
430429

431-
Function ftranslated = inter.getTypedef().requestFunction(f.path, inter.proviso);
430+
Function ftranslated = f.cloneSignature();
431+
432+
ftranslated.translateProviso(inter.getTypedef().proviso, inter.proviso);
432433

433434
boolean found = false;
434435
for (int i = 0; i < e.functions.size(); i++) {

src/Imm/AST/Expression/AddressOf.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@ public void setContext(List<TYPE> context) throws CTX_EXC {
4141
this.expression.setContext(context);
4242
}
4343

44+
public Expression clone() {
45+
return new AddressOf(this.expression.clone(), this.getSource().clone());
46+
}
47+
4448
}

src/Imm/AST/Expression/Arith/Add.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ public Add(Expression left, Expression right, Source source) {
1818
super(left, right, Operator.ADD, source);
1919
}
2020

21+
public BinaryExpression clone() {
22+
return new Add(this.left.clone(), this.right.clone(), this.getSource().clone());
23+
}
24+
2125
}

src/Imm/AST/Expression/Arith/BitAnd.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ public BitAnd(Expression left, Expression right, Source source) {
1818
super(left, right, Operator.LSR, source);
1919
}
2020

21+
public BinaryExpression clone() {
22+
return new BitAnd(this.left.clone(), this.right.clone(), this.getSource().clone());
23+
}
24+
2125
}

src/Imm/AST/Expression/Arith/BitNot.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ public class BitNot extends UnaryExpression {
1717
public BitNot(Expression operand, Source source) {
1818
super(operand, UnaryOperator.NOT, source);
1919
}
20+
21+
public UnaryExpression clone() {
22+
return new BitNot(this.getOperand().clone(), this.getSource().clone());
23+
}
2024

2125
}

src/Imm/AST/Expression/Arith/BitOr.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ public BitOr(Expression left, Expression right, Source source) {
1818
super(left, right, Operator.LSR, source);
1919
}
2020

21+
public BinaryExpression clone() {
22+
return new BitOr(this.left.clone(), this.right.clone(), this.getSource().clone());
23+
}
24+
2125
}

src/Imm/AST/Expression/Arith/BitXor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ public class BitXor extends BinaryExpression {
1717
public BitXor(Expression left, Expression right, Source source) {
1818
super(left, right, Operator.LSR, source);
1919
}
20+
21+
public BinaryExpression clone() {
22+
return new BitXor(this.left.clone(), this.right.clone(), this.getSource().clone());
23+
}
2024

2125
}

0 commit comments

Comments
 (0)