nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src: cleanup importations
[nit.git]
/
src
/
common_ffi
/
common_ffi.nit
diff --git
a/src/common_ffi/common_ffi.nit
b/src/common_ffi/common_ffi.nit
index
c22180c
..
cb9c244
100644
(file)
--- a/
src/common_ffi/common_ffi.nit
+++ b/
src/common_ffi/common_ffi.nit
@@
-19,12
+19,11
@@
# to wrap foreign code in Nit methods.
module common_ffi
# to wrap foreign code in Nit methods.
module common_ffi
-import parser
import modelbuilder
import nitni
import modelbuilder
import nitni
-import ffi_base
+intrude import ffi_base
import extern_classes
import header_dependency
import pkgconfig
import extern_classes
import header_dependency
import pkgconfig
@@
-63,6
+62,11
@@
redef class MModule
ffi_ccu.write_as_impl(self, compdir)
for filename in ffi_ccu.files do ffi_files.add(new ExternCFile(filename, c_compiler_options))
end
ffi_ccu.write_as_impl(self, compdir)
for filename in ffi_ccu.files do ffi_files.add(new ExternCFile(filename, c_compiler_options))
end
+
+ # Avoid the compile a ffi propdef more than once
+ # See `AMethPropdef::compile_ffi_method`
+ # FIXME find a better way
+ private var compiled_ffi_methods = new HashSet[AMethPropdef]
end
redef class AModule
end
redef class AModule
@@
-110,15
+114,13
@@
redef class AModule
end
redef class AMethPropdef
end
redef class AMethPropdef
- private var ffi_has_been_compiled = false
-
# Compile the necessary wrapper around this extern method or constructor
fun compile_ffi_method(mmodule: MModule)
do
assert n_extern_code_block != null
# Compile the necessary wrapper around this extern method or constructor
fun compile_ffi_method(mmodule: MModule)
do
assert n_extern_code_block != null
- if ffi_has_been_compiled then return
- ffi_has_been_compiled = true
+ if mmodule.compiled_ffi_methods.has(self) then return
+ mmodule.compiled_ffi_methods.add self
var language = n_extern_code_block.language
assert language != null
var language = n_extern_code_block.language
assert language != null