+ @NonNull SourceIdentifier identifySource() {
+ final var arg = root.getArgument();
+ verify(arg instanceof Unqualified, "Unexpected argument %s", arg);
+ final var unqualified = (Unqualified) arg;
+
+ final var module = root.namespaceItem(ParserNamespaces.MODULECTX_TO_QNAME, root);
+ if (module != null) {
+ // creates SourceIdentifier for a module
+ return new SourceIdentifier(unqualified, module.revision());
+ }
+
+ // creates SourceIdentifier for a submodule
+ return new SourceIdentifier(unqualified,
+ StmtContextUtils.getLatestRevision(root.declaredSubstatements()).orElse(null));
+ }
+
+ @NonNull DeclaredStatement<?> declaredRoot() {
+ return root.declared();
+ }
+
+ @NonNull EffectiveStatement<?, ?> effectiveRoot() {
+ return root.buildEffective();