Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History of Transformations based on operation instances #157

Open
wants to merge 41 commits into
base: staging
Choose a base branch
from

Conversation

racoelhosilva
Copy link

@racoelhosilva racoelhosilva commented Jul 24, 2024

History of Transformations based on operation instances

Features

  • Event System that is triggered before and after every Joinpoint action (it can be further extended for more functionalities and use cases)
  • History Record for each one of the relevant 12 actions that transform the Clava's underlying AST, allowing checkpoints, rollbacks or simple undos in case of Exceptions
  • Unit tests for the code associated with the History API with 100% coverage in all of the fields

Remaining Topics (before merging)

  • Analyze the Joinpoint action replaceWith(Joinpoint[]) as it is causing some issues
  • Change the return values of setFirstChild and setLastChild from void to the Joinpoint that previously existed there
  • Export the API and test it when executing a script

As of writing this, most functionalities are working as expected, the remaining unchecked topics on the list above will be fixed on this pull request

References

  • This feature updated the contents of the Joinpoints.ts file which is automatically generated. After merging this pull request, it might be adequate to also merge this one
  • This pull request will fix the issues with the replaceWith(Joinpoint[]) function as well as changing the return type of the setFirstChild and setLastChild methods, improving the already functional history system.

This work is related to the topic [CSE02] Recording the History of Source-to-Source Transformations, which is part of the INESC TEC Summer Internship 2024

@racoelhosilva racoelhosilva marked this pull request as ready for review July 26, 2024 11:04
@joaobispo joaobispo changed the base branch from feature/clava-js to staging August 12, 2024 15:43
@@ -0,0 +1,28 @@
import { Joinpoint } from "../../Joinpoints.js";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file can be moved to the lara-framework repo. It needs to have a generic parameter for the join point that extends LaraJoinPoint, then the weaver generator can specialize to the join point of the specific compiler it is generating code for.

import { DetachOperation, DetachReference, InlineCommentOperation, InsertOperation, RemoveChildrenOperation, ReplaceOperation, SetChildOperation, TypeChangeOperation, ValueOperation } from "../history/Operations.js";
import { Joinpoint } from "../../Joinpoints.js";

const eventListener = new EventEmitter();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a global event listener, instantiated by a class in in the lara-framework repo, and other libraries/code register events to that event listener.

Only a small part of this file should be moved to the lara-framework, the part that imports the EventEmitter and instantiates it, it should provide an EventListener class (or LaraEventListener) with a static method that returns the global event listener, and possibly some utility methods (if it makes sense).

Clava-JS/src-api/clava/events/EventListener.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants