*/
stmt.addRequiredSource(RevisionImport.getImportedSourceIdentifier(stmt));
- final String moduleName = stmt.coerceStatementArgument();
+ final String moduleName = stmt.getArgument();
final ModelActionBuilder importAction = stmt.newInferenceAction(SOURCE_PRE_LINKAGE);
final Prerequisite<StmtContext<?, ?, ?>> imported = importAction.requiresCtx(stmt,
PreLinkageModuleNamespace.class, moduleName, SOURCE_PRE_LINKAGE);
@Override
public void apply(final InferenceContext ctx) {
final StmtContext<?, ?, ?> importedModuleContext = imported.resolve(ctx);
- Verify.verify(moduleName.equals(importedModuleContext.coerceRawStatementArgument()));
+ Verify.verify(moduleName.equals(importedModuleContext.getRawArgument()));
final URI importedModuleNamespace = importedModuleContext.getFromNamespace(ModuleNameToNamespace.class,
moduleName);
Verify.verifyNotNull(importedModuleNamespace);
final String impPrefix = SourceException.throwIfNull(
- firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class),
- stmt.getStatementSourceReference(), "Missing prefix statement");
+ firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class), stmt,
+ "Missing prefix statement");
stmt.addToNs(ImpPrefixToNamespace.class, impPrefix, importedModuleNamespace);
}
@Override
public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) {
- InferenceException.throwIf(failed.contains(imported), stmt.getStatementSourceReference(),
- "Imported module [%s] was not found.", moduleName);
+ InferenceException.throwIf(failed.contains(imported), stmt, "Imported module [%s] was not found.",
+ moduleName);
}
});
}
@Override
protected final ImportStatement createDeclared(final StmtContext<String, ImportStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new ImportStatementImpl(ctx.coerceRawStatementArgument(), substatements);
+ return new ImportStatementImpl(ctx.getRawArgument(), substatements);
}
@Override
final String moduleName, final String prefix) {
// When 'revision-date' of an import is not specified in yang source, we need to find revision of imported
// module.
- final QNameModule importedModule = StmtContextUtils.getModuleQNameByPrefix(ctx, prefix);
- SourceException.throwIfNull(importedModule, ctx.sourceReference(),
- "Unable to find import of module %s with prefix %s.", moduleName, prefix);
+ final QNameModule importedModule = SourceException.throwIfNull(
+ StmtContextUtils.getModuleQNameByPrefix(ctx, prefix), ctx,
+ "Unable to find import of module %s with prefix %s.", moduleName, prefix);
return importedModule.getRevision().orElse(null);
}
}