Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Tracking Init, Read, Write accesses to a field
Tracking Init, Read, Write accesses to a field [message #1781930] Wed, 14 February 2018 16:48
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
Dear all.

In my DSL, I have defined the concept of class field (it extends the one from Xtend).

I would like to track initialization, read and write accesses to the declared fields in order to output very specific warning messages to the user of my DSL.

The ReadAndWriteTraking class provides an API for the two first types.
I have created DSLReadAndWriteTracking which is a subtype of ReadAndWritreTraking with the write access (i.e. assignment) tracking.

When I'm calling the tracker within my JvmModelInferrer or my JvmModelCompleter, I obtain the error "cannot root twice" in some cases.

The code used for tracking write accesses is:
protected boolean trackWriteAccess(XExpression expr) {
	for (final XAssignment assign : EcoreUtil2.getAllContentsOfType(expr, XAssignment.class)) {
		final JvmIdentifiableElement feature = assign.getFeature();
		if (feature instanceof JvmField) {
			final JvmField field = (JvmField) feature;
			this.readAndWriteTracking.markAssignmentAccess(field);
		}
	}
}


What is the best location/class for calling the tracking function?
Or should I code everything within my DSL validator instead of keeping track within the ReadAndWriteTracking object? Indeed, within my validator, my calls to the tracker works without error.

Thank you.
Stéphane.
Previous Topic:How to define a greedy version of Xtext until (->)?
Next Topic:createSAXParseException on Windows
Goto Forum:
  


Current Time: Tue Apr 23 13:12:12 GMT 2024

Powered by FUDForum. Page generated in 0.02985 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top