Integrate {Inference,Source}Exception with CommonStmtCtx
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / typedef / TypedefStatementSupport.java
index 64c0c50d4ebaab9fa7e9074126d7f8fc11e31caa..2f534f9b38f4d8aaea61d3d701861d575bf266af 100644 (file)
@@ -100,8 +100,7 @@ public final class TypedefStatementSupport extends
             TypeEffectiveStatement.class);
         final String dflt = findFirstArgument(substatements, DefaultEffectiveStatement.class, null);
         SourceException.throwIf(
-            EffectiveStmtUtils.hasDefaultValueMarkedWithIfFeature(stmt.yangVersion(), typeEffectiveStmt, dflt),
-            stmt.sourceReference(),
+            EffectiveStmtUtils.hasDefaultValueMarkedWithIfFeature(stmt.yangVersion(), typeEffectiveStmt, dflt), stmt,
             "Typedef '%s' has default value '%s' marked with an if-feature statement.", stmt.argument(), dflt);
 
         return new TypedefEffectiveStatementImpl(declared, stmt.wrapSchemaPath(), computeFlags(substatements),
@@ -112,7 +111,7 @@ public final class TypedefStatementSupport extends
         final QName arg = stmt.getArgument();
         final StmtContext<?, ?, ?> existing = parent.getFromNamespace(TypeNamespace.class, arg);
         // RFC7950 sections 5.5 and 6.2.1: identifiers must not be shadowed
-        SourceException.throwIf(existing != null, stmt.sourceReference(), "Duplicate name for typedef %s", arg);
+        SourceException.throwIf(existing != null, stmt, "Duplicate name for typedef %s", arg);
     }
 
     private static void checkDeclared(final StmtContext<QName, TypedefStatement, ?> ctx) {