Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make atkey and atpos on type objects give null.
This simplifies code-gen for array/hash access.
  • Loading branch information
jnthn committed Apr 27, 2013
1 parent eaeda37 commit c7c2297
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
26 changes: 1 addition & 25 deletions src/vm/jvm/QAST/Compiler.nqp
Expand Up @@ -3066,7 +3066,7 @@ class QAST::CompilerJAST {
if $*BINDVAL {
self.compile_var($node)
}
elsif $node.scope ne 'positional' && $node.scope ne 'associative' {
else {
my $var_res := self.compile_var($node);
if ($var_res.type != $RT_OBJ) {
return $var_res;
Expand All @@ -3089,30 +3089,6 @@ class QAST::CompilerJAST {

result($il, $RT_OBJ);
}
else {
my $fb_temp := $node.unique('fb_tmp');
self.as_jast(QAST::Op.new(
:op('ifnull'),
QAST::Op.new(
:op('if'),
QAST::Op.new(
:op('isconcrete'),
QAST::Op.new(
:op('bind'),
QAST::Var.new( :name($fb_temp), :scope('local'), :decl('var') ),
$node[0]
)
),
QAST::Var.new(
:scope($node.scope),
QAST::Var.new( :name($fb_temp), :scope('local') ),
$node[1]
),
QAST::Op.new( :op('null') )
),
$node.fallback
))
}
}

method compile_var($node) {
Expand Down
4 changes: 2 additions & 2 deletions src/vm/jvm/runtime/org/perl6/nqp/sixmodel/TypeObject.java
Expand Up @@ -34,7 +34,7 @@ public String get_str(ThreadContext tc) {
}

public SixModelObject at_pos_boxed(ThreadContext tc, long index) {
throw ExceptionHandling.dieInternal(tc, "Cannot do aggregate operation on a type object");
return null;
}
public void bind_pos_boxed(ThreadContext tc, long index, SixModelObject value) {
throw ExceptionHandling.dieInternal(tc, "Cannot do aggregate operation on a type object");
Expand All @@ -58,7 +58,7 @@ public void splice(ThreadContext tc, SixModelObject from, long offset, long coun
throw ExceptionHandling.dieInternal(tc, "Cannot do aggregate operation on a type object");
}
public SixModelObject at_key_boxed(ThreadContext tc, String key) {
throw ExceptionHandling.dieInternal(tc, "Cannot do aggregate operation on a type object");
return null;
}
public void bind_key_boxed(ThreadContext tc, String key, SixModelObject value) {
throw ExceptionHandling.dieInternal(tc, "Cannot do aggregate operation on a type object");
Expand Down

0 comments on commit c7c2297

Please sign in to comment.