FFILanguage
to all AExternCodeBlock
It will also report errors when using an unknown foreign langages.
nitc :: FFILanguageAssignationPhase :: _languages
All supported languagesnitc :: FFILanguageAssignationPhase :: _objc_language
The Objective-C language visitornitc :: FFILanguageAssignationPhase :: languages
All supported languagesnitc :: FFILanguageAssignationPhase :: languages=
All supported languagesnitc :: FFILanguageAssignationPhase :: objc_language
The Objective-C language visitornitc :: FFILanguageAssignationPhase :: objc_language=
The Objective-C language visitornitc :: FFILanguageAssignationPhase :: verify_foreign_code_on_node
nitc $ FFILanguageAssignationPhase :: SELF
Type of this instance, automatically specialized in every classnitc $ FFILanguageAssignationPhase :: process_nclassdef
Specific actions to execute on the tree of a class definitionnitc $ FFILanguageAssignationPhase :: process_nmodule
Specific actions to execute on the whole tree of a modulenitc $ FFILanguageAssignationPhase :: process_npropdef
Specific actions to execute on the tree of a propertynitc :: Phase :: _in_hierarchy
The dependence relation of the phase with the other phasesnitc :: FFILanguageAssignationPhase :: _languages
All supported languagesnitc :: FFILanguageAssignationPhase :: _objc_language
The Objective-C language visitornitc :: Phase :: _toolcontext
The toolcontext instance attached to the phasecore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: Phase :: defaultinit
core :: Object :: defaultinit
nitc :: Phase :: in_hierarchy
The dependence relation of the phase with the other phasesnitc :: Phase :: in_hierarchy=
The dependence relation of the phase with the other phasescore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: FFILanguageAssignationPhase :: languages
All supported languagesnitc :: FFILanguageAssignationPhase :: languages=
All supported languagescore :: Object :: native_class_name
The class name of the object in CString format.nitc :: FFILanguageAssignationPhase :: objc_language
The Objective-C language visitornitc :: FFILanguageAssignationPhase :: objc_language=
The Objective-C language visitorcore :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: Phase :: process_annotated_node
Specific actions to execute on annotated nodesnitc :: Phase :: process_mainmodule
Specific action to execute on the whole program.nitc :: Phase :: process_nclassdef
Specific actions to execute on the tree of a class definitionnitc :: Phase :: process_nmodule
Specific actions to execute on the whole tree of a modulenitc :: Phase :: process_nmodule_after
Specific actions to execute on the whole tree of a modulenitc :: Phase :: process_npropdef
Specific actions to execute on the tree of a propertynitc :: Phase :: toolcontext
The toolcontext instance attached to the phasenitc :: Phase :: toolcontext=
The toolcontext instance attached to the phasenitc :: FFILanguageAssignationPhase :: verify_foreign_code_on_node
# Phase that assign a `FFILanguage` to all `AExternCodeBlock`
#
# It will also report errors when using an unknown foreign langages.
class FFILanguageAssignationPhase
super Phase
# All supported languages
var languages = new Array[FFILanguage]
redef fun process_nmodule(nmodule)
do
for block in nmodule.n_extern_code_blocks do
verify_foreign_code_on_node( block )
end
end
redef fun process_npropdef(npropdef)
do
if npropdef isa AMethPropdef then
var code_block = npropdef.n_extern_code_block
if code_block != null then
verify_foreign_code_on_node( code_block )
end
end
end
redef fun process_nclassdef(nclassdef)
do
if nclassdef isa AStdClassdef and nclassdef.n_extern_code_block != null then
verify_foreign_code_on_node( nclassdef.n_extern_code_block.as(not null) )
end
end
private fun verify_foreign_code_on_node(n: AExternCodeBlock)
do
var found = false
for v in languages do
var identified = v.identify_language(n)
if identified then
if found and identified then
toolcontext.error(n.location, "FFI Error: two languages identified as possible handlers.")
end
n.language = v
found = true
end
end
if not found then toolcontext.error(n.location, "FFI Error: unsupported language.")
end
end
src/ffi/light_ffi_base.nit:30,1--79,3
redef class FFILanguageAssignationPhase
var c_language: FFILanguage = new CLanguage(self)
end
src/ffi/light_c.nit:24,1--26,3
redef class FFILanguageAssignationPhase
var cpp_language: FFILanguage = new CPPLanguage(self)
end
src/ffi/cpp.nit:23,1--25,3
redef class FFILanguageAssignationPhase
# The Objective-C language visitor
var objc_language: FFILanguage = new ObjCLanguage(self)
end
src/ffi/objc.nit:28,1--31,3
redef class FFILanguageAssignationPhase
var java_language: FFILanguage = new JavaLanguage(self)
end
src/ffi/java.nit:26,1--28,3