Commit 2683d4fb authored by Christoph Reichenbach's avatar Christoph Reichenbach
Browse files

Improved source location reporting

parent b6d2c339
...@@ -310,7 +310,9 @@ aspect IRGen { ...@@ -310,7 +310,9 @@ aspect IRGen {
// formal param types // formal param types
lang.ir.List<IRTypeRef> irTypes = new lang.ir.List<>(); lang.ir.List<IRTypeRef> irTypes = new lang.ir.List<>();
for (VarDecl d : getFormals()) { for (VarDecl d : getFormals()) {
irTypes.add(d.variableType().genIRTypeRef()); IRTypeRef tyref = d.variableType().genIRTypeRef();
tyref.setSourceLocation(d.sourceLocation());
irTypes.add(tyref);
} }
func.setParamTypeList(irTypes); func.setParamTypeList(irTypes);
// return type, if any // return type, if any
...@@ -466,6 +468,7 @@ aspect IRGen { ...@@ -466,6 +468,7 @@ aspect IRGen {
// copy this to the return value // copy this to the return value
ctx.addInsn(new IRCopyInsn(new IRVarRef(ctx.getReturnVar()), retVal)); ctx.addInsn(new IRCopyInsn(new IRVarRef(ctx.getReturnVar()), retVal));
IRCodeBB currentBB = ctx.getCurrentBB(); IRCodeBB currentBB = ctx.getCurrentBB();
IRReturn ret = new IRReturn(new IRVarRef(ctx.getReturnVar())); IRReturn ret = new IRReturn(new IRVarRef(ctx.getReturnVar()));
ret.setSourceLocation(sourceLocation()); ret.setSourceLocation(sourceLocation());
currentBB.setIRCodeExit(ret); currentBB.setIRCodeExit(ret);
......
...@@ -130,6 +130,7 @@ aspect IRGenExpr { ...@@ -130,6 +130,7 @@ aspect IRGenExpr {
ctx.addInsn(new IRConstantInsn(size, new IRInteger((long) this.getNumExpr()))); ctx.addInsn(new IRConstantInsn(size, new IRInteger((long) this.getNumExpr())));
IRNewArrayInsn newInsn = new IRNewArrayInsn().setDst(dst) IRNewArrayInsn newInsn = new IRNewArrayInsn().setDst(dst)
.setIRType((IRType) IRModule.makeAnyTypeRef()).setSize(size); // FIXME: more precise type if we get type inference .setIRType((IRType) IRModule.makeAnyTypeRef()).setSize(size); // FIXME: more precise type if we get type inference
newInsn.setSourceLocation(this.sourceLocation());
ctx.addInsn(newInsn); ctx.addInsn(newInsn);
long indexCounter = 0; long indexCounter = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment