| 116 | } |
| 117 | |
| 118 | TypeAnnotation * Module::resolveAnnotation ( const TypeInfo * info ) { |
| 119 | if ( info->type != Type::tHandle ) { |
| 120 | return nullptr; |
| 121 | } |
| 122 | intptr_t ann = (intptr_t) (info->annotation_or_name); |
| 123 | if ( ann & 1 ) { |
| 124 | auto bound = daScriptEnvironment::getBound(); |
| 125 | DAS_VERIFYF(bound && bound->modules,"missing bound environment"); |
| 126 | // we add ~ at the beginning of the name for padding |
| 127 | // if name is allocated by the compiler, it does not guarantee that it is aligned |
| 128 | // we check if there is a ~ at the beginning of the name, and if it is - we skip it |
| 129 | // that way we can accept both aligned and unaligned names |
| 130 | auto cvtbuf = (char *) ann; |
| 131 | if ( cvtbuf[0]=='~' ) cvtbuf++; |
| 132 | string moduleName, annName; |
| 133 | splitTypeName(cvtbuf, moduleName, annName); |
| 134 | TypeAnnotation * resolve = nullptr; |
| 135 | for ( auto pm = bound->modules; pm!=nullptr; pm=pm->next ) { |
| 136 | if ( pm->name == moduleName ) { |
| 137 | if ( auto annT = pm->findAnnotation(annName) ) { |
| 138 | resolve = (TypeAnnotation *) annT; |
| 139 | } |
| 140 | break; |
| 141 | } |
| 142 | } |
| 143 | if ( bound->g_resolve_annotations ) { |
| 144 | info->annotation_or_name = resolve; |
| 145 | } |
| 146 | return resolve; |
| 147 | } else { |
| 148 | return info->annotation_or_name; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | atomic<int> g_envTotal(0); |
| 153 |
nothing calls this directly
no test coverage detected