载入中...
搜索中...
未找到
ProjectIndexAutomatic.cpp
浏览该文件的文档.
1#include <Poco/JSON/Array.h>
2#include <Poco/JSON/Parser.h>
3#include <algorithm>
4#include <set>
8
10namespace {
11using Expression = eve::script::ScriptExpression;
12using Contract = eve::script::BindingContract;
13using Array = Poco::JSON::Array;
14struct Type {
15 std::string name;
16 std::set<std::string> values, identities, hosts;
17};
18struct Function {
19 std::string file;
21};
22struct Analysis {
23 Snapshot& snapshot;
25 std::map<std::string, std::vector<Function>> functions;
26 std::map<std::string, std::string> factories;
27 std::map<std::string, Type> variables;
28 std::map<std::string, Object::Ptr> edgeKeys;
29 std::map<std::string, const Contract*> methods;
30
31 std::string localKey(const std::string& file, const std::string& scope, const std::string& name) const {
32 return file + "#" + scope + "#" + name;
33 }
34 std::string bindingKey(const std::string& file, const eve::script::ScriptBindingSyntax& binding) const {
35 return binding.local ? localKey(file, binding.scope, binding.name) : "global:" + binding.name;
36 }
37 Type variable(const std::string& file, const std::string& scope, const std::string& name) const {
38 auto local = variables.find(localKey(file, scope, name));
39 if (local != variables.end()) return local->second;
40 auto global = variables.find("global:" + name);
41 return global == variables.end() ? Type{} : global->second;
42 }
43 bool merge(Type& into, const Type& from) {
44 if (from.name.empty() || from.name == "null") return false;
45 auto before = into;
46 if (into.name.empty() || into.name == "null")
47 into.name = from.name;
48 else if (into.name != from.name)
49 into.name = "dynamic";
50 into.values.insert(from.values.begin(), from.values.end());
51 into.identities.insert(from.identities.begin(), from.identities.end());
52 into.hosts.insert(from.hosts.begin(), from.hosts.end());
53 if (into.values.size() > 8 || into.identities.size() > 8 || into.hosts.size() > 8) {
54 into.name = "dynamic";
55 into.values.clear();
56 into.identities.clear();
57 into.hosts.clear();
58 }
59 return before.name != into.name || before.values != into.values || before.identities != into.identities ||
60 before.hosts != into.hosts;
61 }
62 const Contract* contract(const Expression& expression, const std::string& file, const std::string& scope,
63 unsigned depth = 0) const {
64 if (depth >= 64 || expression.kind != "call" || expression.operands.empty()) return nullptr;
65 const auto& callee = expression.operands[0];
66 if (callee.kind != "member" || callee.operands.empty()) return nullptr;
67 auto owner = type(callee.operands[0], file, scope, depth + 1);
68 if (owner.name.starts_with("module:")) return registry.find(owner.name.substr(7) + "/" + callee.value);
69 auto found = methods.find(owner.name + '\0' + callee.value);
70 return found == methods.end() ? nullptr : found->second;
71 }
72 Type type(const Expression& expression, const std::string& file, const std::string& scope,
73 unsigned depth = 0) const {
74 if (depth >= 64) return {};
75 if (expression.kind == "string") return {"string", {expression.value}, {}, {}};
76 if (expression.kind == "number") return {"number", {}, {}, {}};
77 if (expression.kind == "identifier") {
78 if (expression.value == "null") return {"null", {}, {}, {}};
79 return variable(file, scope, expression.value);
80 }
81 if (expression.kind != "call" || expression.operands.empty()) return {};
82 const auto& callee = expression.operands[0];
83 if (callee.kind == "member" && !callee.operands.empty() && callee.operands[0].kind == "identifier" &&
84 callee.operands[0].value == "eve" && !variables.contains(localKey(file, scope, "eve")) &&
85 !variables.contains("global:eve")) {
86 auto factory = factories.find(callee.value);
87 if (factory != factories.end() && expression.operands.size() == 1)
88 return {"module:" + factory->second, {}, {}, {}};
89 }
90 const auto* api = contract(expression, file, scope, depth + 1);
91 if (!api) return {};
92 Type value;
93 value.name =
94 api->semantics && !api->semantics->resultClass.empty() ? api->semantics->resultClass : api->returnType;
95 if (value.name == "dynamic") value.name.clear();
96 if (api->semantics && api->semantics->role == "scene_ref") {
97 value.identities = argument(expression, api->semantics->identityArgument, file, scope).values;
98 value.hosts = argument(expression, api->semantics->relatedArgument, file, scope).values;
99 }
100 return value;
101 }
102 Type argument(const Expression& call, int index, const std::string& file, const std::string& scope) const {
103 if (index < 0 || static_cast<size_t>(index + 1) >= call.operands.size()) return {};
104 return type(call.operands[static_cast<size_t>(index + 1)], file, scope);
105 }
106 Object::Ptr source(const std::string& file, unsigned line, const std::string& pointer = "") const {
107 Object::Ptr value = new Object();
108 value->set("file", file);
109 value->set("inputHash", snapshot.files.at(file)->hash);
110 if (line) value->set("line", line);
111 if (!pointer.empty()) value->set("pointer", pointer);
112 return value;
113 }
114 Object::Ptr node(const std::string& id, const std::string& kind, Object::Ptr origin = {}) {
115 auto found = snapshot.nodes.find(id);
116 if (found != snapshot.nodes.end()) return found->second;
117 if (snapshot.nodes.size() >= 16384) throw std::runtime_error("Automatic graph node budget exceeded");
118 Object::Ptr value = new Object();
119 value->set("id", id);
120 value->set("kind", kind);
121 value->set("label", id);
122 value->set("status", "resolved");
123 value->set("evidence", "compiler-derived");
124 value->set("semantic", true);
125 if (origin) value->set("source", origin);
126 snapshot.nodes.emplace(id, value);
127 return value;
128 }
129 void edge(const std::string& from, const std::string& to, const std::string& relation, Object::Ptr origin) {
130 if (!snapshot.nodes.contains(from) || !snapshot.nodes.contains(to) ||
131 snapshot.nodes.at(from)->getValue<std::string>("status") != "resolved" ||
132 snapshot.nodes.at(to)->getValue<std::string>("status") != "resolved")
133 return;
134 const auto key = from + '\0' + to + '\0' + relation;
135 if (auto found = edgeKeys.find(key); found != edgeKeys.end()) {
136 found->second->set("occurrences", found->second->getValue<unsigned>("occurrences") + 1);
137 return;
138 }
139 if (snapshot.edges.size() >= 32768) throw std::runtime_error("Automatic graph edge budget exceeded");
140 Object::Ptr value = new Object();
141 value->set("from", from);
142 value->set("to", to);
143 value->set("relation", relation);
144 value->set("source", origin);
145 value->set("evidence", "typed-source-candidate");
146 value->set("sourceCoverage", "representative-source");
147 value->set("occurrences", 1u);
148 edgeKeys.emplace(key, value);
149 snapshot.edges.push_back(value);
150 }
152 Object::Ptr sceneEntity(const std::string& host, const std::string& nodeId, Object::Ptr origin,
153 const std::string& displayName = {}, const std::string& coverage = "script-ref-only") {
154 auto id = "entity:" + host + "/" + nodeId;
155 auto item = node(id, "scene_entity", origin);
156 item->set("sceneHost", host);
157 item->set("nodeId", nodeId);
158 if (!displayName.empty())
159 item->set("label", displayName);
160 else if (!item->has("label") || item->getValue<std::string>("label") == id)
161 item->set("label", nodeId);
162 const auto existing = item->optValue<std::string>("definitionCoverage", "");
163 if (existing.empty() || existing == "script-ref-only" || coverage != "script-ref-only")
164 item->set("definitionCoverage", coverage);
165 return item;
166 }
167 std::string functionId(const std::string& name) const {
168 auto found = functions.find(name);
169 if (found == functions.end() || found->second.size() != 1) return "";
170 return (found->second[0].file.starts_with("tests/") ? "test:" : "script:") + name;
171 }
172 void prepare() {
173 for (const auto& api : registry.snapshot()) {
174 if (api.semantics) factories[api.semantics->factory] = api.module;
175 if (!api.scriptClass.empty()) {
176 const auto key = api.scriptClass + '\0' + api.method;
177 if (methods.contains(key))
178 methods[key] = nullptr;
179 else
180 methods[key] = registry.find(api.key());
181 }
182 }
183 // Root slots from load.nut (`gfx`, `scene`, …) are module receivers; seed
184 // them so `gfx.loadTexture("…")` resolves without requiring eve.Graphics().
185 for (const auto& entry : factories) {
186 Type slot;
187 slot.name = "module:" + entry.second;
188 variables["global:" + entry.second] = slot;
189 }
190 for (const auto& [path, file] : snapshot.files) {
191 if (!file->error.empty()) continue;
192 for (const auto& value : file->structure.classes) {
193 auto item = node("class:" + value.name, "script_class", source(path, value.line));
194 if (item->has("fields") || item->getValue<std::string>("status") == "ambiguous") {
195 item->set("status", "ambiguous");
196 item->remove("fields");
197 for (auto& [id, field] : snapshot.nodes)
198 if (id.starts_with("field:" + value.name + ".")) {
199 field->set("status", "ambiguous");
200 field->remove("type");
201 field->remove("defaultValue");
202 }
203 continue;
204 }
205 Array::Ptr fields = new Array();
206 for (const auto& binding : file->structure.bindings)
207 if (binding.scope == value.name + ".") {
208 Object::Ptr field = new Object();
209 field->set("name", binding.name);
210 field->set("type", binding.declaredType.empty() ? "dynamic" : binding.declaredType);
211 field->set("initializerKind", binding.expression.kind);
212 fields->add(field);
213 auto fieldId = "field:" + value.name + "." + binding.name;
214 auto indexed = node(fieldId, "script_field", source(path, binding.expression.line));
215 indexed->set("type", field->get("type"));
216 indexed->set("initializerKind", binding.expression.kind);
217 if (binding.expression.kind == "string" || binding.expression.kind == "number")
218 indexed->set("defaultValue", binding.expression.value);
219 edge("class:" + value.name, fieldId, "contains", source(path, binding.expression.line));
220 }
221 item->set("fields", fields);
222 }
223 for (const auto& function : file->structure.functions) {
224 functions[function.name].push_back({path, &function});
225 for (const auto& parameter : function.parameters)
227 }
228 for (const auto& binding : file->structure.bindings) {
229 auto& value = variables[bindingKey(path, binding)];
230 if (!binding.declaredType.empty()) value.name = binding.declaredType;
231 }
232 }
233 for (int pass = 0; pass < 16; ++pass) {
234 bool changed = false;
235 for (const auto& [path, file] : snapshot.files) {
236 if (!file->error.empty()) continue;
237 for (const auto& binding : file->structure.bindings)
238 changed |=
239 merge(variables[bindingKey(path, binding)], type(binding.expression, path, binding.scope));
240 for (const auto& call : file->structure.calls) {
241 const auto& expression = call.expression;
242 if (expression.operands.empty() || expression.operands[0].kind != "identifier") continue;
243 auto function = functions.find(expression.operands[0].value);
244 if (function == functions.end() || function->second.size() != 1) continue;
245 const auto& target = function->second[0];
246 for (size_t p = 0; p < target.syntax->parameters.size() && p + 1 < expression.operands.size(); ++p)
247 changed |= merge(
248 variables[localKey(target.file, target.syntax->name, target.syntax->parameters[p].name)],
249 type(expression.operands[p + 1], path, call.scope));
250 }
251 }
252 if (!changed) break;
253 }
254 // A write outside the resolved expression subset invalidates every
255 // possible static alias. Null initialization does not invalidate a ref.
256 for (const auto& [path, file] : snapshot.files)
257 for (const auto& binding : file->structure.bindings)
258 if (type(binding.expression, path, binding.scope).name.empty())
259 variables[bindingKey(path, binding)].name = "dynamic";
260 for (int pass = 0; pass < 16; ++pass)
261 for (const auto& [path, file] : snapshot.files)
262 for (const auto& binding : file->structure.bindings)
263 merge(variables[bindingKey(path, binding)], type(binding.expression, path, binding.scope));
264 for (const auto& [name, locations] : functions) {
265 if (locations.size() != 1) {
266 Object::Ptr diagnostic = new Object();
267 diagnostic->set("code", "ambiguous_function");
268 diagnostic->set("id", name);
269 snapshot.diagnostics.push_back(diagnostic);
270 continue;
271 }
272 const auto& location = locations[0];
273 auto item = node(functionId(name), location.file.starts_with("tests/") ? "test" : "script",
274 source(location.file, location.syntax->line));
275 Array::Ptr parameters = new Array();
276 for (const auto& parameter : location.syntax->parameters) {
277 Object::Ptr value = new Object();
278 value->set("name", parameter.name);
279 auto inferred = variable(location.file, name, parameter.name);
280 value->set("type", inferred.name.empty() ? "dynamic" : inferred.name);
281 parameters->add(value);
282 }
283 item->set("parameters", parameters);
284 const auto dot = name.rfind('.');
285 if (dot != std::string::npos)
286 edge("class:" + name.substr(0, dot), functionId(name), "declares",
287 source(location.file, location.syntax->line));
288 }
289 }
290 std::string jsonType(const Poco::Dynamic::Var& value) const {
291 if (value.type() == typeid(Object::Ptr)) return "object";
292 if (value.type() == typeid(Array::Ptr)) return "array";
293 if (value.isString()) return "string";
294 if (value.isBoolean()) return "boolean";
295 if (value.isInteger()) return "integer";
296 return value.isNumeric() ? "number" : "unknown";
297 }
298 void schemaObjects(const Poco::Dynamic::Var& value, const std::string& path, const std::string& pointer,
299 Object::Ptr schema, const std::string& apiKey) {
300 if (value.type() == typeid(Object::Ptr)) {
301 auto object = value.extract<Object::Ptr>();
302 const auto identity = schema->getValue<std::string>("identityField");
303 bool matches = object->has(identity) && object->get(identity).isString();
304 for (const auto& field : *schema->getObject("fields"))
305 matches &= object->has(field.first) &&
306 jsonType(object->get(field.first)) == field.second.convert<std::string>();
307 if (matches) {
308 auto id = schema->getValue<std::string>("kind") + ":" + object->getValue<std::string>(identity);
309 auto item = node(id, schema->getValue<std::string>("kind"), source(path, 0, pointer));
310 if (item->has("definition")) {
311 item->set("status", "ambiguous");
312 item->remove("definition");
313 Object::Ptr diagnostic = new Object();
314 diagnostic->set("code", "ambiguous_schema_identity");
315 diagnostic->set("id", id);
316 snapshot.diagnostics.push_back(diagnostic);
317 } else if (item->getValue<std::string>("status") != "ambiguous")
318 item->set("definition", object);
319 item->set("schemaContract", apiKey);
320 item->set("evidence", "engine-schema-shape");
321 }
322 for (const auto& field : *object) {
323 std::string escaped;
324 for (char c : field.first) escaped += c == '~' ? "~0" : c == '/' ? "~1" : std::string(1, c);
325 schemaObjects(field.second, path, pointer + "/" + escaped, schema, apiKey);
326 }
327 } else if (value.type() == typeid(Array::Ptr)) {
328 auto array = value.extract<Array::Ptr>();
329 for (size_t i = 0; i < array->size(); ++i)
330 schemaObjects(array->get(static_cast<unsigned>(i)), path, pointer + "/" + std::to_string(i), schema,
331 apiKey);
332 }
333 }
334 void project(std::string& version) {
335 prepare();
337 for (const auto& api : registry.snapshot()) {
338 if (!api.semantics) continue;
339 version += api.key() + '\0' + api.toJson() + '\0';
340 if (!api.semantics->schemaJson.empty()) {
341 Poco::JSON::Parser parser;
342 auto schema = parser.parse(api.semantics->schemaJson).extract<Object::Ptr>();
343 for (const auto& [path, file] : snapshot.files)
344 if (file->error.empty() && !file->json.isEmpty())
345 schemaObjects(file->json, path, "", schema, api.key());
346 }
347 }
348 std::map<std::string, std::set<std::string>> nativeByFunction, calledFunctions;
349 struct SceneDefine {
350 std::string nodeId, displayName, from, parentId;
351 bool opens = true;
352 Object::Ptr origin;
353 };
354 for (const auto& [path, file] : snapshot.files) {
355 if (!file->error.empty()) continue;
356 std::map<std::string, std::set<std::string>> filters, subjects, mounts;
357 std::map<std::string, std::vector<SceneDefine>> defines;
358 std::map<std::string, std::vector<std::string>> openStacks;
359 int unresolvedDefines = 0;
360 for (const auto& call : file->structure.calls) {
361 const auto& expression = call.expression;
362 if (expression.operands.empty()) continue;
363 auto from = functionId(call.scope);
364 auto origin = source(path, expression.line);
365 const auto& callee = expression.operands[0];
366 if (callee.kind == "identifier") {
367 auto target = functionId(callee.value);
368 if (!from.empty() && !target.empty()) {
369 edge(from, target, "calls", origin);
370 calledFunctions[from].insert(target);
371 }
372 }
373 const auto* api = contract(expression, path, call.scope);
374 if (!api && !from.empty() && callee.kind == "member" &&
375 !type(expression, path, call.scope).name.starts_with("module:")) {
376 auto item = snapshot.nodes.at(from);
377 auto unknowns = item->getArray("unknownCalls");
378 if (!unknowns) {
379 unknowns = new Array();
380 item->set("unknownCalls", unknowns);
381 }
382 if (unknowns->size() < 16) {
383 Object::Ptr unknown = new Object();
384 unknown->set("method", callee.value);
385 unknown->set("source", origin);
386 unknown->set("reason", "receiver type unresolved or method ambiguous");
387 unknowns->add(unknown);
388 } else
389 item->set("unknownCallsTruncated", true);
390 }
391 if (!api) continue;
392 auto apiId = "api:" + api->key();
393 auto item = node(apiId, "engine_api");
394 Poco::JSON::Parser parser;
395 item->set("contract", parser.parse(api->toJson()));
396 item->set("evidence", "engine-build-contract");
397 if (!from.empty()) {
398 edge(from, apiId, "uses", origin);
399 nativeByFunction[from].insert(apiId);
400 }
401 if (!api->semantics || api->semantics->role.empty()) continue;
402 const auto& rule = *api->semantics;
403 auto identity = argument(expression, rule.identityArgument, path, call.scope);
404 if (rule.role == "scene_ref" && identity.values.size() == 1) {
405 auto host = argument(expression, rule.relatedArgument, path, call.scope);
406 if (host.values.size() == 1) sceneEntity(*host.values.begin(), *identity.values.begin(), origin);
407 } else if ((rule.role == "scene_define" || rule.role == "scene_leaf") && identity.values.size() == 1) {
408 auto& stack = openStacks[call.scope];
409 auto related = argument(expression, rule.relatedArgument, path, call.scope);
410 std::string display;
411 if (related.values.size() == 1) display = *related.values.begin();
412 const bool opens = rule.role == "scene_define";
413 if (!opens && stack.empty()) {
414 ++unresolvedDefines;
415 } else {
416 const auto parent = stack.empty() ? "" : stack.back();
417 defines[call.scope].push_back({*identity.values.begin(), display, from, parent, opens, origin});
418 if (opens) stack.push_back(*identity.values.begin());
419 }
420 } else if (rule.role == "scene_pop") {
421 auto& stack = openStacks[call.scope];
422 if (!stack.empty())
423 stack.pop_back();
424 else
425 ++unresolvedDefines;
426 } else if (rule.role == "scene_mount" && identity.values.size() == 1) {
427 mounts[call.scope].insert(*identity.values.begin());
428 } else if (rule.role == "resource_load" && identity.values.size() == 1) {
429 const auto rel = *identity.values.begin();
430 const auto norm = pathText(sourcePath(rel).lexically_normal());
431 if (sourcePath(rel).is_absolute() || norm.starts_with("../") ||
432 norm.find("/../") != std::string::npos) {
433 Object::Ptr diagnostic = new Object();
434 diagnostic->set("code", "resource_path_escaped");
435 diagnostic->set("path", rel);
436 diagnostic->set("loaderApi", api->key());
437 snapshot.diagnostics.push_back(diagnostic);
438 } else {
439 auto assetId = "asset:" + rel;
440 auto asset = node(assetId, "project_asset", origin);
441 asset->set("path", rel);
442 asset->set("loaderApi", api->key());
443 asset->set("label", rel);
444 std::string presence = "unchecked";
445 if (!snapshot.projectDir.empty()) {
446 std::error_code error;
447 const auto full = sourcePath(snapshot.projectDir) / sourcePath(rel);
448 presence = std::filesystem::is_regular_file(full, error) && !error ? "present" : "absent";
449 }
450 asset->set("filePresence", presence);
451 if (!from.empty()) edge(from, assetId, "uses_asset", origin);
452 }
453 } else if (rule.role == "scene_write" && callee.kind == "member" && !callee.operands.empty()) {
454 auto target = type(callee.operands[0], path, call.scope);
455 if (target.identities.size() == 1 && target.hosts.size() == 1) {
456 auto entity = sceneEntity(*target.hosts.begin(), *target.identities.begin(), origin);
457 edge(from, entity->getValue<std::string>("id"), "updates", origin);
458 edge(entity->getValue<std::string>("id"), apiId, "uses", origin);
459 } else
460 item->set("targetCoverage", "dynamic-or-ambiguous");
461 } else if (rule.role == "event_emit" && identity.values.size() == 1) {
462 auto eventId = "event:" + *identity.values.begin();
463 node(eventId, "event", origin);
464 edge(from, eventId, "emits", origin);
465 auto subject = argument(expression, rule.relatedArgument, path, call.scope);
466 if (subject.values.size() == 1)
467 edge("quest:" + *subject.values.begin(), eventId, "subject_of", origin);
468 } else if ((rule.role == "event_type" || rule.role == "event_subject") && !call.comparison.empty() &&
469 call.comparedValue.kind == "string") {
470 if (rule.role == "event_type") {
471 auto id = "event:" + call.comparedValue.value;
472 node(id, "event", origin);
473 edge(id, from, "filtered_by", origin);
474 filters[call.scope].insert(id);
475 } else
476 subjects[call.scope].insert(call.comparedValue.value);
477 } else if (rule.role == "quest_read" || rule.role == "quest_complete") {
478 if (identity.values.size() == 1)
479 edge("quest:" + *identity.values.begin(), from,
480 rule.role == "quest_read" ? "read_by" : "completion_candidate", origin);
481 }
482 }
483 // Scene adapter: beginNode/beginGroup/addNode identities bind to a unique
484 // mount/remount host in the same function. begin/end order reconstructs
485 // contains edges. Missing/ambiguous hosts stay unpublished.
486 for (const auto& [scope, items] : defines) {
487 const auto hostIt = mounts.find(scope);
488 if (hostIt == mounts.end() || hostIt->second.size() != 1) {
489 unresolvedDefines += static_cast<int>(items.size());
490 continue;
491 }
492 if (!openStacks[scope].empty()) unresolvedDefines += static_cast<int>(openStacks[scope].size());
493 const auto& host = *hostIt->second.begin();
494 for (const auto& define : items) {
495 auto entity =
496 sceneEntity(host, define.nodeId, define.origin, define.displayName, "script-beginNode+mount");
497 if (!define.parentId.empty()) {
498 entity->set("parentNodeId", define.parentId);
499 auto parent = sceneEntity(host, define.parentId, define.origin);
500 edge(parent->getValue<std::string>("id"), entity->getValue<std::string>("id"), "contains",
501 define.origin);
502 }
503 if (!define.from.empty())
504 edge(define.from, entity->getValue<std::string>("id"), "defines", define.origin);
505 }
506 }
507 if (unresolvedDefines && snapshot.stats) {
508 snapshot.stats->set("sceneDefinesUnresolved",
509 snapshot.stats->optValue<int>("sceneDefinesUnresolved", 0) + unresolvedDefines);
510 }
511 for (const auto& [scope, events] : filters)
512 for (const auto& event : events)
513 for (const auto& subject : subjects[scope])
514 edge("quest:" + subject, event, "subject_filter", source(path, 0));
515 }
516 // Test references come from source-directory ownership and actual direct
517 // call reachability, not from a function name substring.
518 for (const auto& [name, locations] : functions) {
519 if (locations.size() != 1 || !locations[0].file.starts_with("tests/")) continue;
520 std::set<std::string> reached{functionId(name)}, checked;
521 for (int depth = 0; depth < 16; ++depth) {
522 auto before = reached.size();
523 auto current = reached;
524 for (const auto& function : current) {
525 checked.insert(nativeByFunction[function].begin(), nativeByFunction[function].end());
526 reached.insert(calledFunctions[function].begin(), calledFunctions[function].end());
527 }
528 if (reached.size() == before) break;
529 }
530 for (const auto& api : checked)
531 edge(api, functionId(name), "tested_by", source(locations[0].file, locations[0].syntax->line));
532 }
533 }
534};
535} // namespace
536void automaticGraph(Snapshot& snapshot, std::string& version) {
537 Analysis analysis{snapshot, eve::script::generatedBindingContracts(), {}, {}, {}, {}, {}};
538 analysis.project(version);
539}
540} // namespace eve::dev::project_index
LogicalId target
int subject
Definition AnimSmr.cpp:163
bool changed
glm::vec4 p[6]
std::string nodeId
SQObjectPtr key
Definition ECS.cpp:155
std::string name
Definition ECS.cpp:154
std::vector< std::string > fields
Definition ECS.cpp:42
EnvironmentMetricContract contract
std::uint64_t parentId
std::int32_t second
std::int32_t c
std::int32_t first
JobScope scope
const ColourScope * parent
std::string local
std::string to
std::string relation
std::string coverage
std::map< std::string, Node > nodes
std::string from
std::string id
Snapshot snapshot
std::shared_ptr< OceanGpuSpectrum > owner
glm::dvec3 origin
std::string error
Definition Package.cpp:174
std::vector< particles::ParticleRecordEvent > events
eve::action::ActionVfxBinding binding
std::array< uint32_t, 9 > parameters
std::vector< ParticleBakeMaterial > bindings
std::string path
Definition PlayHost.cpp:111
std::map< std::string, std::vector< Function > > functions
std::map< std::string, const Contract * > methods
const eve::script::ScriptFunctionSyntax * syntax
std::set< std::string > values
std::set< std::string > hosts
std::set< std::string > identities
std::map< std::string, Object::Ptr > edgeKeys
std::map< std::string, Type > variables
std::map< std::string, std::string > factories
std::string file
const eve::script::BindingContractRegistry & registry
Object::Ptr value
std::string pointer
const EntityFact * entity
std::string slot
std::string parameter
const RoadNode * node
bool found
MigrationFunction function
unsigned line
std::string_view source
std::map< size_t, ScriptCallSyntax > calls
size_t begin
size_t end
std::string kind
double current
std::string string
Heightmap global
std::string sourcePath
Json object
float size
Definition TreeMesh.cpp:158
UIHostHandle host
std::uint32_t depth
uint32_t index
uint64_t identity
Value get(const char *key) const
Returns the value.
Definition Json.cpp:337
Registry consumed by compiler checks and tooling protocol adapters.
const BindingContract * find(std::string_view key) const noexcept
Finds a binding contract.
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
constexpr uint32_t Function
std::string pathText(const std::filesystem::path &path)
UTF-8 source path, including Windows project names.
void automaticGraph(Snapshot &snapshot, std::string &version)
Project typed compiler syntax through generated engine contracts; no project declarations required.
Snapshot project(Files files, Object::Ptr stats, std::string defaultProjectId, std::string projectDir)
Build a candidate evidence graph without touching the published snapshot.
bool has(const std::vector< std::reference_wrapper< const HouseComponent > > &values)
Result< ForceVector > checked(ForceVector value)
Definition ForceMath.h:21
double dot(ForceVector a, ForceVector b)
Definition ForceMath.h:14
const BindingContractRegistry & generatedBindingContracts()
Process-wide generated Binding Contracts for this linked engine build.
EVENGINE_API_FOUNDATION std::string_view scriptStructureProviderHash()
Build-generated source fingerprint of the structural analyzer and project projection.
enum EVENGINE_API_FOUNDATION Array
OT_ARRAY (editable via Runtime array APIs / ReflectedPropertyModel).
Definition Runtime.h:120
Complete script-facing contract for a native function or method.
Source binding; local bindings remain in their owning function scope.
Owning syntax expression; dynamic means outside the supported expression subset.
Named function body and source parameters; offsets address the original source.