Add leafrefBaseType(const std::string&)

Will be useful in the upcoming describe command.

Change-Id: I180b0a3c87db8e856251e28f34aa3940c52d1ad0
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 297ea53..4b4a8bb 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -281,16 +281,28 @@
     return impl_leafType(getSchemaNode(path));
 }
 
-yang::LeafDataTypes YangSchema::leafrefBaseType(const schemaPath_& location, const ModuleNodePair& node) const
+namespace {
+yang::LeafDataTypes impl_leafrefBaseType(const libyang::S_Schema_Node& node)
 {
     using namespace std::string_literals;
-    libyang::Schema_Node_Leaf leaf(getSchemaNode(location, node));
+    libyang::Schema_Node_Leaf leaf(node);
     try {
         return lyTypeToLeafDataTypes(leaf.type()->info()->lref()->target()->type()->base());
     } catch (std::logic_error& ex) {
-        throw UnsupportedYangTypeException("the type of "s + fullNodeName(location, node) + " is not supported: " + ex.what());
+        throw UnsupportedYangTypeException("the type of "s + node->name() + " is not supported: " + ex.what());
     }
 }
+}
+
+yang::LeafDataTypes YangSchema::leafrefBaseType(const schemaPath_& location, const ModuleNodePair& node) const
+{
+    return impl_leafrefBaseType(getSchemaNode(location, node));
+}
+
+yang::LeafDataTypes YangSchema::leafrefBaseType(const std::string& path) const
+{
+    return impl_leafrefBaseType(getSchemaNode(path));
+}
 
 std::set<std::string> YangSchema::modules() const
 {