# Indexed collection are ordoned collections.
# The first item is 0. The last is `length'-1.
-interface IndexedCollectionRead[E]
+interface SequenceRead[E]
special MapRead[Int, E]
# Get the first item.
# Is equivalent with `self'[0].
# Indexed collection are ordoned collections.
# The first item is 0. The last is `length'-1.
-interface IndexedCollection[E]
-special IndexedCollectionRead[E]
+interface Sequence[E]
+special SequenceRead[E]
special Map[Int, E]
special SimpleCollection[E]
# Set the first item.
# One dimention array of objects.
class AbstractArrayRead[E]
-special IndexedCollectionRead[E]
+special SequenceRead[E]
# The current length
redef readable var _length: Int = 0
# Resizeable one dimention array of objects.
class AbstractArray[E]
special AbstractArrayRead[E]
-special IndexedCollection[E]
+special Sequence[E]
fun enlarge(cap: Int) is abstract
redef fun push(item) do add(item)
# Double linked lists.
class List[E]
-special IndexedCollection[E]
+special Sequence[E]
# Access
redef fun [](index) do return get_node(index).item
return "<{object_id.to_hex}"
end
- protected fun args: IndexedCollection[String]
+ protected fun args: Sequence[String]
do
return sys.args
end
end
redef class Sys
- var _args_cache: nullable IndexedCollection[String]
+ var _args_cache: nullable Sequence[String]
- redef fun args: IndexedCollection[String]
+ redef fun args: Sequence[String]
do
if _args_cache == null then init_args
return _args_cache.as(not null)
# A routine is a sequence of icodes with entry iregisters (params) and an exit iregister (result)
class IRoutine
# The parameters of the routine
- readable var _params: IndexedCollection[IRegister]
+ readable var _params: Sequence[IRegister]
# The closure declared
- readable writable var _closure_decls: nullable IndexedCollection[IClosureDecl] = null
+ readable writable var _closure_decls: nullable Sequence[IClosureDecl] = null
# The result of the routine
readable var _result: nullable IRegister
# The location of the iroutine (if any)
readable writable var _location: nullable Location = null
- init(p: IndexedCollection[IRegister], r: nullable IRegister)
+ init(p: Sequence[IRegister], r: nullable IRegister)
do
_params = p.to_a
_result = r
redef fun arity do return _exprs.length
# All arguments
- readable var _exprs: IndexedCollection[IRegister]
+ readable var _exprs: Sequence[IRegister]
# All closure definition
- readable writable var _closure_defs: nullable IndexedCollection[nullable IClosureDef]
+ readable writable var _closure_defs: nullable Sequence[nullable IClosureDef]
- init(e: nullable IndexedCollection[IRegister])
+ init(e: nullable Sequence[IRegister])
do
if e == null then
_exprs = new Array[IRegister]
# The called method
readable var _property: MMMethod
- init(p: MMMethod, e: IndexedCollection[IRegister])
+ init(p: MMMethod, e: Sequence[IRegister])
do
super(e)
_property = p
special ICall
# The type to instantiate
readable var _stype: MMType
- init(t: MMType, p: MMMethod, a: IndexedCollection[IRegister])
+ init(t: MMType, p: MMMethod, a: Sequence[IRegister])
do
super(p, a)
_stype = t
# The !break sequence (if any)
readable writable var _break_seq: nullable ISeq = null
- init(c: IClosureDecl, e: IndexedCollection[IRegister])
+ init(c: IClosureDecl, e: Sequence[IRegister])
do
super(e)
_closure_decl = c
# Special character sequence '@@@' will be substitued in order with the arguments
readable var _code: String
- init(c: String, e: nullable IndexedCollection[IRegister])
+ init(c: String, e: nullable Sequence[IRegister])
do
super(e)
_code = c
redef class IRoutine
# Inline an iroutine in an icode sequence
- fun inline_in_seq(seq: ISeq, args: IndexedCollection[IRegister]): nullable IRegister
+ fun inline_in_seq(seq: ISeq, args: Sequence[IRegister]): nullable IRegister
do
var d = new ICodeDupContext
if args.length != params.length then print "{args.length} != {params.length}"
# Duplicate a bunch of registers
# Subsequent invocation will return the same registers
- fun dup_iregs(regs: IndexedCollection[IRegister]): IndexedCollection[IRegister]
+ fun dup_iregs(regs: Sequence[IRegister]): Sequence[IRegister]
do
var a = new Array[IRegister].with_capacity(regs.length)
for r in regs do
end
redef class ASignature
- fun fill_iroutine_parameters(v: A2IContext, orig_sig: MMSignature, params: IndexedCollection[IRegister], closdecls: nullable IndexedCollection[IClosureDecl])
+ fun fill_iroutine_parameters(v: A2IContext, orig_sig: MMSignature, params: Sequence[IRegister], closdecls: nullable Sequence[IClosureDecl])
do
for ap in n_params do
var reg = v.variable(ap.variable)
# See the License for the specific language governing permissions and
# limitations under the License.
-fun test_coll(c: IndexedCollection[Object], e: Object...)
+fun test_coll(c: Sequence[Object], e: Object...)
do
print("c: {c.to_s.is_empty}")
print("empty: {c.is_empty}")