@@ -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| {
@@ -149,8 +152,9 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> {
149152 index : & ' cg Index ,
150153 annotations : & ' cg AstAnnotations ,
151154 llvm_index : & ' cg LlvmTypedIndex < ' ink > ,
155+ online_change : OnlineChange ,
152156 ) -> PouGenerator < ' ink , ' cg > {
153- PouGenerator { llvm, index, annotations, llvm_index }
157+ PouGenerator { llvm, index, annotations, llvm_index, online_change }
154158 }
155159
156160 fn mangle_function ( & self , implementation : & ImplementationIndexEntry ) -> String {
@@ -281,8 +285,10 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> {
281285
282286 let curr_f = module. add_function ( implementation. get_call_name ( ) , function_declaration, None ) ;
283287
284- let section_name = self . mangle_function ( implementation) ;
285- curr_f. set_section ( Some ( & section_name) ) ;
288+ if self . online_change == OnlineChange :: Enabled {
289+ let section_name = self . mangle_function ( implementation) ;
290+ curr_f. set_section ( Some ( & section_name) ) ;
291+ }
286292
287293 let pou_name = implementation. get_call_name ( ) ;
288294 if let Some ( pou) = self . index . find_pou ( pou_name) {
0 commit comments