Skip to main content



      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 11:48
Eclipse UserFriend
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: Thu Jul 03 01:30:22 EDT 2025

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

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

Back to the top