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

Function try_find_struct

utils/dasFormatter/formatter.cpp:146–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 }
145
146 optional<StructurePtr> try_find_struct(const string &name) {
147 if (state.program != nullptr) {
148 const auto library = state.program->library;
149 auto structs = state.program->findStructure(name);
150 auto aliases = state.program->findAlias(name);
151 if (!structs.empty()) {
152 assert(structs.size() == 1);
153 assert(aliases.empty());
154 return structs.front();
155 } else if (!aliases.empty()) {
156 assert(aliases.size() == 1);
157 }
158 }
159 return std::nullopt;
160 }
161
162 bool can_default_init(const string &name) {
163 auto maybe_struct = try_find_struct(name);

Callers 2

can_default_initFunction · 0.85
can_init_withFunction · 0.85

Calls 5

assertFunction · 0.85
findStructureMethod · 0.45
findAliasMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected