modelize_property: remove old-style accesors
[nit.git] / src / common_ffi / c_compiler_options.nit
index 7733990..ca64759 100644 (file)
@@ -20,6 +20,7 @@
 module c_compiler_options
 
 import c
+import cpp
 
 redef class ToolContext
        var c_compiler_options_phase: Phase = new CCompilerOptionsPhase(self, null)
@@ -30,13 +31,15 @@ private class CCompilerOptionsPhase
 
        fun compiler_annotation_name: String do return "c_compiler_option"
        fun linker_annotation_name: String do return "c_linker_option"
+       fun cpp_compiler_annotation_name: String do return "cpp_compiler_option"
 
        redef fun process_annotated_node(nmoduledecl, nat)
        do
                # Skip if we are not interested
                var annotation_name = nat.n_atid.n_id.text
                if annotation_name != compiler_annotation_name and
-                  annotation_name != linker_annotation_name then return
+                  annotation_name != linker_annotation_name and
+                  annotation_name != cpp_compiler_annotation_name then return
 
                # Do some validity checks and print errors if the annotation is used incorrectly
                var modelbuilder = toolcontext.modelbuilder
@@ -131,26 +134,33 @@ private class CCompilerOptionsPhase
                end
 
                # retreive module
-               var nmodule = nmoduledecl.parent.as(AModule)
+               var mmodule = nmoduledecl.parent.as(AModule).mmodule.as(not null)
 
                for opt in simplified_options do
                        var cmd = opt.option
                        if annotation_name == compiler_annotation_name then
-                               process_c_compiler_annotation(nmodule, cmd)
+                               process_c_compiler_annotation(mmodule, cmd)
                        else if annotation_name == linker_annotation_name then
-                               process_c_linker_annotation(nmodule, cmd)
+                               process_c_linker_annotation(mmodule, cmd)
+                       else if annotation_name == cpp_compiler_annotation_name then
+                               process_cpp_compiler_annotation(mmodule, cmd)
                        else abort
                end
        end
 
-       fun process_c_compiler_annotation(nmodule: AModule, opt: String)
+       fun process_c_compiler_annotation(mmodule: MModule, opt: String)
        do
-               nmodule.c_compiler_options = "{nmodule.c_compiler_options} {opt}"
+               mmodule.c_compiler_options = "{mmodule.c_compiler_options} {opt}"
        end
 
-       fun process_c_linker_annotation(nmodule: AModule, opt: String)
+       fun process_c_linker_annotation(mmodule: MModule, opt: String)
        do
-               nmodule.c_linker_options = "{nmodule.c_linker_options} {opt}"
+               mmodule.c_linker_options = "{mmodule.c_linker_options} {opt}"
+       end
+
+       fun process_cpp_compiler_annotation(mmodule: MModule, opt: String)
+       do
+               mmodule.cpp_compiler_options = "{mmodule.cpp_compiler_options} {opt}"
        end
 end