MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / getCurrentSearchModule

Function getCurrentSearchModule

src/builtin/module_builtin_ast.cpp:166–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 // variable lookup with all the rules
165
166 Module * getCurrentSearchModule(Program * program, Function * func, const char * _moduleName) {
167 string moduleName = _moduleName ? _moduleName : "";
168 if ( moduleName=="_" ) {
169 moduleName = "*";
170 return program->thisModule.get();
171 } else if ( moduleName=="__" ) {
172 moduleName = program->thisModule->name;
173 return program->thisModule.get();
174 } else if ( func ) {
175 if ( func->fromGeneric ) {
176 auto origin = func->getOrigin();
177 if ( moduleName.empty() ) { // ::foo in generic means generic::goo, not this::foo
178 moduleName = origin->module->name;
179 }
180 return origin->module;
181 } else {
182 return func->module;
183 }
184 } else {
185 return program->thisModule.get();
186 }
187 }
188
189 bool canAccessGlobalVariable ( const VariablePtr & pVar, Module * mod, Module * thisMod ) {
190 if ( !pVar->private_variable ) {

Callers 1

findMatchingVariableFunction · 0.85

Calls 3

getOriginMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected