@Override
protected LeafStatement createDeclared(final StmtContext<QName, LeafStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new RegularLeafStatement(ctx.coerceStatementArgument(), substatements);
+ return new RegularLeafStatement(ctx.getArgument(), substatements);
}
@Override
protected LeafStatement createEmptyDeclared(final StmtContext<QName, LeafStatement, ?> ctx) {
- return new EmptyLeafStatement(ctx.coerceStatementArgument());
+ return new EmptyLeafStatement(ctx.getArgument());
}
@Override
protected LeafEffectiveStatement createEffective(final Current<QName, LeafStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
final TypeEffectiveStatement<?> typeStmt = SourceException.throwIfNull(
- findFirstStatement(substatements, TypeEffectiveStatement.class), stmt.sourceReference(),
- "Leaf is missing a 'type' statement");
+ findFirstStatement(substatements, TypeEffectiveStatement.class), stmt,
+ "Leaf is missing a 'type' statement");
final String dflt = findFirstArgument(substatements, DefaultEffectiveStatement.class, null);
SourceException.throwIf(
- EffectiveStmtUtils.hasDefaultValueMarkedWithIfFeature(stmt.yangVersion(), typeStmt, dflt),
- stmt.sourceReference(),
+ EffectiveStmtUtils.hasDefaultValueMarkedWithIfFeature(stmt.yangVersion(), typeStmt, dflt), stmt,
"Leaf '%s' has default value '%s' marked with an if-feature statement.", stmt.argument(), dflt);
- final SchemaPath path = stmt.getSchemaPath();
final LeafSchemaNode original = (LeafSchemaNode) stmt.original();
final int flags = new FlagsBuilder()
.setHistory(stmt.history())
.toFlags();
final LeafStatement declared = stmt.declared();
+ final SchemaPath path = stmt.wrapSchemaPath();
return original == null ? new EmptyLeafEffectiveStatement(declared, path, flags, substatements)
: new RegularLeafEffectiveStatement(declared, path, flags, substatements, original);
}