added copyFrom:count: to ByteArray

This commit is contained in:
hyunghwan.chung 2018-06-12 10:17:32 +00:00
parent aa3c15d2a3
commit 34ee56784d
2 changed files with 15 additions and 3 deletions

View File

@ -110,8 +110,6 @@ class(#pointer) Array(SequenceableCollection)
^self at: (self size - 1). ^self at: (self size - 1).
} }
method copy: anArray method copy: anArray
{ {
0 priorTo: (anArray size) do: [:i | self at: i put: (anArray at: i) ]. 0 priorTo: (anArray size) do: [:i | self at: i put: (anArray at: i) ].
@ -160,6 +158,11 @@ class(#pointer) Array(SequenceableCollection)
^(self class new: newsz) copy: self from: start to: end ^(self class new: newsz) copy: self from: start to: end
} }
method copyFrom: start count: count
{
^(self class new: count) copy: self from: start to: (start + count - 1)
}
method replaceFrom: start to: stop with: replacement method replaceFrom: start to: stop with: replacement
{ {
^self replaceFrom: start to: stop with: replacement startingAt: 0. ^self replaceFrom: start to: stop with: replacement startingAt: 0.

View File

@ -5543,7 +5543,16 @@ start_over:
* identifer if it encounters an assignment operator after an identifer. * identifer if it encounters an assignment operator after an identifer.
* i only allow a basic expression after a logical operator. * i only allow a basic expression after a logical operator.
* the basic expression doesn't include an assignment expression * the basic expression doesn't include an assignment expression
* if it is not in the parenthesis. so i nullify the following 2 variables */ * if it is not in the parenthesis. so i nullify the following 2 variables
*
* a := 30 > 20 and 10 > 20 is equavelent to a := (30 > 20 and 10 > 20).
*
* you will encounter a syntax error for the following expression as the
* expression end after y.
* a := 30 > 20 and y := 10 > 20
*
* a := 30 > 20 and (y := 10 > 20) is perfectly valid.
*/
ident = MOO_NULL; ident = MOO_NULL;
ident_loc = MOO_NULL; ident_loc = MOO_NULL;
goto start_over; goto start_over;