[ClavaAst] Adds legacy methods FunctionDecl.getDeclaration() and .getDefinition()
@@ -401,6 +401,15 @@ public class FunctionDecl extends DeclaratorDecl implements NodeWithScope {
return getAppTry().map(app -> app.getFunctionPrototypes(this)).orElse(Collections.emptyList());
}
+ /**
+ * Legacy method, please use getPrototypes() instead.
+ *
+ * @return
+ */
+ public Optional<FunctionDecl> getDeclaration() {
+ return getPrototypes().stream().findFirst();
+ }
+
/**
*
* @return the node representing the implementation of this function.
@@ -420,6 +429,15 @@ public class FunctionDecl extends DeclaratorDecl implements NodeWithScope {
return getAppTry().flatMap(app -> app.getFunctionImplementation(this));
}
+ /**
+ * Legacy method, please use getImplementation() instead.
+ *
+ * @return
+ */
+ public Optional<FunctionDecl> getDefinition() {
+ return getImplementation();
+ }
+
/**
*
* @return all the FunctionDecl related to this function (e.g., prototypes, implementation)
