@@ -16,6 +16,7 @@ use crate::{
1616 index:: { self , ImplementationType } ,
1717 resolver:: { AstAnnotations , Dependency } ,
1818 typesystem:: { DataType , DataTypeInformation , VarArgs , DINT_TYPE } ,
19+ OnlineChange ,
1920} ;
2021
2122/// The pou_generator contains functions to generate the code for POUs (PROGRAM, FUNCTION, FUNCTION_BLOCK)
@@ -49,6 +50,7 @@ pub struct PouGenerator<'ink, 'cg> {
4950 index : & ' cg Index ,
5051 annotations : & ' cg AstAnnotations ,
5152 llvm_index : & ' cg LlvmTypedIndex < ' ink > ,
53+ online_change : OnlineChange ,
5254}
5355
5456/// Creates opaque implementations for all callable items in the index
@@ -61,9 +63,10 @@ pub fn generate_implementation_stubs<'ink>(
6163 annotations : & AstAnnotations ,
6264 types_index : & LlvmTypedIndex < ' ink > ,
6365 debug : & mut DebugBuilderEnum < ' ink > ,
66+ online_change : OnlineChange ,
6467) -> Result < LlvmTypedIndex < ' ink > , Diagnostic > {
6568 let mut llvm_index = LlvmTypedIndex :: default ( ) ;
66- let pou_generator = PouGenerator :: new ( llvm, index, annotations, types_index) ;
69+ let pou_generator = PouGenerator :: new ( llvm, index, annotations, types_index, online_change ) ;
6770 let implementations = dependencies
6871 . into_iter ( )
6972 . filter_map ( |it| {
@@ -150,8 +153,9 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> {
150153 index : & ' cg Index ,
151154 annotations : & ' cg AstAnnotations ,
152155 llvm_index : & ' cg LlvmTypedIndex < ' ink > ,
156+ online_change : OnlineChange ,
153157 ) -> PouGenerator < ' ink , ' cg > {
154- PouGenerator { llvm, index, annotations, llvm_index }
158+ PouGenerator { llvm, index, annotations, llvm_index, online_change }
155159 }
156160
157161 fn mangle_function ( & self , implementation : & ImplementationIndexEntry ) -> Result < String , Diagnostic > {
@@ -286,8 +290,10 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> {
286290
287291 let curr_f = module. add_function ( implementation. get_call_name ( ) , function_declaration, None ) ;
288292
289- let section_name = self . mangle_function ( implementation) ?;
290- curr_f. set_section ( Some ( & section_name) ) ;
293+ if self . online_change == OnlineChange :: Enabled {
294+ let section_name = self . mangle_function ( implementation) ?;
295+ curr_f. set_section ( Some ( & section_name) ) ;
296+ }
291297
292298 let pou_name = implementation. get_call_name ( ) ;
293299 if let Some ( pou) = self . index . find_pou ( pou_name) {
0 commit comments