Skip to content

Commit

Permalink
- Fixed a minor bug for array autovivification on slice creation.
Browse files Browse the repository at this point in the history
Example:
	var x = [];
	x[4,5] = [1,2];		# slice autovivification
	say x.map {"test"};	# works correctly now
	say x;			# prints: [nil, nil, nil, nil, 1, 2]
  • Loading branch information
trizen committed Jun 20, 2015
1 parent ab75ef9 commit 3b7ee7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Sidef/Exec.pm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ package Sidef::Exec {
}

foreach my $ind ($#{$self_obj} + 1 .. $num) {
$self_obj->[$num] //= Sidef::Variable::Variable->new(name => '', type => 'var');
$self_obj->[$ind] //= Sidef::Variable::Variable->new(name => '', type => 'var');
}

$ind = $num;
Expand Down

0 comments on commit 3b7ee7e

Please sign in to comment.