changed the compiler to allow assignment to an argument in a method

This commit is contained in:
hyunghwan.chung
2017-01-09 13:20:46 +00:00
parent 7460ce819c
commit 2528dcdbe5
6 changed files with 39 additions and 36 deletions

View File

@ -123,11 +123,22 @@ class(#byte) ByteArray(Collection)
class Set(Collection)
{
dcl tally bucket.
method new: size
{
^self new initialize: size.
}
method initialize
{
^self initialize: 128. (* TODO: default initial size *)
}
method initialize: size
{
(size <= 0) ifTrue: [size := 2].
self.tally := 0.
self.bucket := Array new: 128. (* TODO: initial size *)
self.bucket := Array new: size.
}
method size

View File

@ -7,6 +7,7 @@
#include 'Collect.moo'.
#include 'Process.moo'.
(* -------------------------------------------------------------------------- *)
class FFI(Object)
{
@ -78,9 +79,7 @@ f isNil ifTrue: [ self error: 'No such function' ].
}
}
#########################################################################################
(* -------------------------------------------------------------------------- *)
#include 'Stdio.moo'.
#include 'Console.moo'.

View File

@ -80,7 +80,6 @@ class MyObject(Object)
'duplicate temporary variable name'
'duplicate variable name'
'duplicate block argument name'
'cannot assign to argument'
'undeclared variable'
'unusable variable in compiled code'
'inaccessible variable'