Skip to content

Commit

Permalink
Eliminate Mu::!STORE -- we no longer do "copy pmc" semantics for values.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Jun 27, 2010
1 parent 2334011 commit 0a87aa7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 51 deletions.
5 changes: 1 addition & 4 deletions src/Perl6/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1873,10 +1873,7 @@ method term:sym<!!!>($/) {

method term:sym<dotty>($/) {
my $past := $<dotty>.ast;
$past.unshift(PAST::Op.new(
:pirop('descalarref PP'),
PAST::Var.new( :name('$_'), :scope('lexical') )
));
$past.unshift(PAST::Var.new( :name('$_'), :scope('lexical') ) );
make $past;
}

Expand Down
46 changes: 0 additions & 46 deletions src/builtins/Mu.pir
Original file line number Diff line number Diff line change
Expand Up @@ -354,52 +354,6 @@ until we get roles).
.end
=item !STORE(source)
Store C<source> into C<self>, performing type checks
as needed. (This method is listed with the other public
methods simply because I expect it may switch to public
in the future.)
=cut
.sub '!STORE' :method :subid('Mu::!STORE')
.param pmc source
# Get hold of the source object to assign.
$I0 = can source, 'item'
if $I0 goto source_fetch
source = deobjectref source
source = new ['ObjectRef'], source
goto have_source
source_fetch:
source = source.'item'()
source = deobjectref source
have_source:
# If source and destination are the same, we're done.
eq_addr self, source, store_done

# Need a type-check?
.local pmc type
type = getprop 'type', self
if null type goto type_check_done
$I0 = type.'ACCEPTS'(source)
unless $I0 goto type_check_failed

# All is well - do the assignment.
type_check_done:
copy self, source

store_done:
.return (self)

type_check_failed:
# XXX TODO: Awesomize this error.
'&die'('Type check failed for assignment')
.end


=item WHENCE()
Return the invocant's auto-vivification closure.
Expand Down
13 changes: 12 additions & 1 deletion src/builtins/assign.pir
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,18 @@ src/builtins/assign.pir - assignment operations
# If the lhs isn't a scalar container, delegate to
# object's STORE method.
$P0 = getprop 'scalar', cont
if null $P0 goto cont_store
unless null $P0 goto scalar_store
$I0 = can cont, '!STORE'
if $I0 goto cont_store

# We should never arrive here. Anything that is marked 'rw'
# should either be a Perl6Scalar (with the 'scalar' property
# set) or a container that understands !STORE, such as Hash or Array.
# However, there's some legacy code that fails to set 'scalar',
# so we patch it in here to keep things going.
$I0 = isa cont, ['ObjectRef']
unless $I0 goto cont_store
setprop cont, 'scalar', cont

scalar_store:
# perform any needed typecheck
Expand Down

0 comments on commit 0a87aa7

Please sign in to comment.