import org.opendaylight.yangtools.yang.model.util.type.IdentityrefTypeBuilder;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.IdentityNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.CommonStmtCtx;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
abstract class AbstractIdentityRefSpecificationSupport
extends BaseStatementSupport<String, IdentityRefSpecification,
for (StmtContext<QName, BaseStatement, ?> baseStmt : baseStatements) {
final QName baseIdentity = baseStmt.coerceStatementArgument();
final StmtContext<?, ?, ?> stmtCtx = stmt.getFromNamespace(IdentityNamespace.class, baseIdentity);
- InferenceException.throwIfNull(stmtCtx, stmt.getStatementSourceReference(),
+ InferenceException.throwIfNull(stmtCtx, stmt.sourceReference(),
"Referenced base identity '%s' doesn't exist in given scope (module, imported modules, submodules)",
baseIdentity.getLocalName());
}
@Override
protected final IdentityRefSpecification createEmptyDeclared(
final StmtContext<String, IdentityRefSpecification, ?> ctx) {
- throw noBase(ctx.getStatementSourceReference());
+ throw noBase(ctx);
}
@Override
final Current<String, IdentityRefSpecification> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
if (substatements.isEmpty()) {
- throw noBase(stmt.sourceReference());
+ throw noBase(stmt);
}
final IdentityrefTypeBuilder builder = BaseTypes.identityrefTypeBuilder(stmt.getSchemaPath());
return new TypeEffectiveStatementImpl<>(stmt.declared(), substatements, builder);
}
- private static SourceException noBase(final StatementSourceReference ref) {
+ private static SourceException noBase(final CommonStmtCtx stmt) {
/*
* https://tools.ietf.org/html/rfc7950#section-9.10.2
*
* statement, MUST be present at least once if the type is
* "identityref".
*/
- return new SourceException("At least one base statement has to be present", ref);
+ return new SourceException("At least one base statement has to be present", stmt.sourceReference());
}
}
\ No newline at end of file