Open alexnask opened 8 years ago
Here is an example in some code I've been writing:
UnsafeArray.ooc
UnsafeArray: cover template <T> { data: T* length: Int init: func@ (=length) { data = gc_malloc(T size * length) } operator [] (i: Int) -> T { data[i] } operator@ []= (i: Int, t: T) -> T { data[i] = t } }
Bitmap.ooc
import ../UnsafeArray RgbColor: cover { r, g, b: UInt8 init: func@ (=r, =g, =b) } Bitmap: class { width, height: Int data: UnsafeArray<RgbColor> pixelCount ::= width * height /* ... */ }
This piece of code generates invalid C code because the generated template instance does not have access to RgbColor's declaration.
Rock should automatically deduce what additional imports are needed and add them to the template type's module.
Temporary fix is obviously adding imports manually (e.g. import Bitmap in this example)
Here is an example in some code I've been writing:
UnsafeArray.ooc
Bitmap.ooc
This piece of code generates invalid C code because the generated template instance does not have access to RgbColor's declaration.
Rock should automatically deduce what additional imports are needed and add them to the template type's module.