| 106 | } |
| 107 | |
| 108 | bool Program::patchAnnotations() { |
| 109 | bool astChanged = false; |
| 110 | thisModule->functions.foreach([&](auto fn){ |
| 111 | if ( fn->isTemplate ) return false; |
| 112 | for ( auto & ann : fn->annotations ) { |
| 113 | if ( ann->annotation->rtti_isFunctionAnnotation() ) { |
| 114 | auto fann = static_cast<FunctionAnnotation*>(ann->annotation); |
| 115 | string err; |
| 116 | if ( !fann->patch(fn, *thisModuleGroup, ann->arguments, options, err, astChanged) ) { |
| 117 | error("function annotation patch failed\n", err, "", fn->at, CompilationError::runtime_function_annotation ); |
| 118 | } |
| 119 | if ( astChanged ) return true; |
| 120 | } |
| 121 | } |
| 122 | return false; |
| 123 | }); |
| 124 | if ( astChanged ) goto done; |
| 125 | thisModule->structures.find_first([&](auto st){ |
| 126 | for ( auto & ann : st->annotations ) { |
| 127 | if ( ann->annotation->rtti_isStructureAnnotation() ) { |
| 128 | auto sann = static_cast<StructureAnnotation*>(ann->annotation); |
| 129 | string err; |
| 130 | if ( !sann->patch(st, *thisModuleGroup, ann->arguments, err, astChanged) ) { |
| 131 | error("structure annotation patch failed\n", err, "", st->at, CompilationError::runtime_structure_annotation ); |
| 132 | } |
| 133 | if ( astChanged ) return true; |
| 134 | } |
| 135 | } |
| 136 | return false; |
| 137 | }); |
| 138 | done:; |
| 139 | return astChanged; |
| 140 | } |
| 141 | |
| 142 | struct NormalizeOptionTypes : Visitor { |
| 143 | static void run ( ProgramPtr program ) { |
no test coverage detected