Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improve error messages for repr mismatch
  • Loading branch information
FROGGS committed Feb 28, 2015
1 parent d038633 commit b91a78d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/vm/jvm/runtime/org/perl6/nqp/sixmodel/SixModelObject.java
Expand Up @@ -2,6 +2,7 @@

import org.perl6.nqp.runtime.ExceptionHandling;
import org.perl6.nqp.runtime.ThreadContext;
import org.perl6.nqp.sixmodel.REPRRegistry;

/**
* All 6model objects derive from this base class. A bunch of the REPR
Expand Down Expand Up @@ -49,28 +50,30 @@ public long is_attribute_initialized(ThreadContext tc, SixModelObject class_hand
* Boxing related functions.
*/
public void set_int(ThreadContext tc, long value) {
throw ExceptionHandling.dieInternal(tc, "This representation can not box a native int");
throw ExceptionHandling.dieInternal(tc, this.st.REPR.name + " representation can not box a native int");
}
public long get_int(ThreadContext tc) {
throw ExceptionHandling.dieInternal(tc, "This representation can not unbox to a native int");
throw ExceptionHandling.dieInternal(tc, this.st.REPR.name + " representation can not unbox to a native int");
}
public void set_num(ThreadContext tc, double value) {
throw ExceptionHandling.dieInternal(tc, "This representation can not box a native num");
throw ExceptionHandling.dieInternal(tc, this.st.REPR.name + " representation can not box a native num");
}
public double get_num(ThreadContext tc) {
throw ExceptionHandling.dieInternal(tc, "This representation can not unbox to a native num");
throw ExceptionHandling.dieInternal(tc, this.st.REPR.name + " representation can not unbox to a native num");
}
public void set_str(ThreadContext tc, String value) {
throw ExceptionHandling.dieInternal(tc, "This representation can not box a native str");
throw ExceptionHandling.dieInternal(tc, this.st.REPR.name + " representation can not box a native str");
}
public String get_str(ThreadContext tc) {
throw ExceptionHandling.dieInternal(tc, "This representation can not unbox to a native str");
throw ExceptionHandling.dieInternal(tc, this.st.REPR.name + " representation can not unbox to a native str");
}
public void set_boxing_of(ThreadContext tc, long reprId, Object value) {
throw ExceptionHandling.dieInternal(tc, "This representation can not box another");
throw ExceptionHandling.dieInternal(tc, this.st.REPR.name + " representation can not box "
+ REPRRegistry.getById((int)reprId).name);
}
public Object get_boxing_of(ThreadContext tc, long reprId) {
throw ExceptionHandling.dieInternal(tc, "This representation can not unbox another");
throw ExceptionHandling.dieInternal(tc, this.st.REPR.name + " representation can not unbox "
+ REPRRegistry.getById((int)reprId).name);
}

/**
Expand Down

0 comments on commit b91a78d

Please sign in to comment.