Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Compiling Xassignment to FeatureCall
Compiling Xassignment to FeatureCall [message #1187814] Fri, 15 November 2013 04:43
Matthias Spiller is currently offline Matthias Spiller
Messages: 13
Registered: September 2013
Junior Member
I have an xbase-grammar which I infer to Java-code.
In the inferred code, I use my own data types.
I have changed the TypeComputer and -Provider so that a XStringLiteral is computed to type MyString.
This is working without problems.


The DSL code
var a = "abc"
a = "def"

is inferred to

MyString a = new MyString("abc");
a = new MyString("def");


I would like this to be inferred to:
final MyString a  = new MyString("abc");
a.set(new MyString("def"));

So the variable declarations should create a final variable. But still I would like the be able to change the value by using the set-method.


What would be the best way to achieve this?
Would I need to modify the grammar and make my own rules for assignments?
Or is it possible to influence the scoping so that the assignment is pointed to call the set-method?

Thanks for any hint,
Matthias
Previous Topic:Scoping and inferring inner classes
Next Topic:Extend XBase grammar
Goto Forum:
  


Current Time: Sat Apr 19 16:12:08 EDT 2014

Powered by FUDForum. Page generated in 0.01951 seconds