Permalink
Browse files

Make atkey and atpos on type objects give null.

This simplifies code-gen for array/hash access.
  • Loading branch information...
1 parent eaeda37 commit c7c2297b7e2d23fa28ad2fe46ac1016030702303 @jnthn jnthn committed Apr 27, 2013
Showing with 3 additions and 27 deletions.
  1. +1 −25 src/vm/jvm/QAST/Compiler.nqp
  2. +2 −2 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/TypeObject.java
@@ -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;
@@ -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) {
@@ -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");
@@ -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");

0 comments on commit c7c2297

Please sign in to comment.