Return an element of a native array.

The method is unsafe and is just a direct wrapper for the specific implementation of native arrays

Property definitions

nitc $ AbstractCompilerVisitor :: native_array_get
	# Return an element of a native array.
	# The method is unsafe and is just a direct wrapper for the specific implementation of native arrays
	fun native_array_get(native_array: RuntimeVariable, index: Int): RuntimeVariable is abstract
src/compiler/abstract_compiler.nit:1364,2--1366,93

nitc $ SeparateCompilerVisitor :: native_array_get
	redef fun native_array_get(nat, i)
	do
		var nclass = mmodule.native_array_class
		var recv = "((struct instance_{nclass.c_name}*){nat})->values"
		# Because the objects are boxed, return the box to avoid unnecessary (or broken) unboxing/reboxing
		var res = self.new_expr("{recv}[{i}]", compiler.mainmodule.object_type)
		return res
	end
src/compiler/separate_compiler.nit:2217,2--2224,4

nitc $ GlobalCompilerVisitor :: native_array_get
	redef fun native_array_get(nat, i)
	do
		var recv = "((struct {nat.mcasttype.c_name}*){nat})->values"
		var ret_type = nat.mcasttype.as(MClassType).arguments.first
		return self.new_expr("{recv}[{i}]", ret_type)
	end
src/compiler/global_compiler.nit:453,2--458,4