Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Stopping error "Duplicate Constrct 'foo' in Struct 'bar'" for function that take different
Stopping error "Duplicate Constrct 'foo' in Struct 'bar'" for function that take different [message #674976] Sun, 29 May 2011 22:05 Go to next message
Richard Cookman is currently offline Richard CookmanFriend
Messages: 7
Registered: May 2011
Junior Member

This is my last problem i'm hoping someone may point me in the direction of someone who might have found a solution to this.

My programming language destingushes functions on both the name and the types of the paramaters. So the problems is simple the eclipse text editor reports that there is a problems with functions of the same name in the same sturcture when there actually isn't.

The ideal would be able to append to the name the types of the paramaters as they are found out, this way correct (for my langauge) duplicate functions could be found and the error given. Otherwise I would need some way to supress the error completely and let only the compiler output find error for duplicates.
Re: Stopping error "Duplicate Constrct 'foo' in Struct 'bar'" for function that take diffe [message #675039 is a reply to message #674976] Mon, 30 May 2011 06:20 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1162
Registered: July 2009
Senior Member
Hi,

the workflow for generating the language infrastructure contains JavaValidatorFragmen that by default has a diplicate name check enabled. Simply comment out the line

composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"

or adapt the NamesAreUniqueValidationHelper so that it does not trigger for functions.

My feeling is that adding the parameter types to the name of the function (which you could do via implementing your own IQualifiedNameProvider) is not a good idea. It might make the scoping a bit complicated. My first approach would be to implement my own duplicate name check which takes parameter types into account. You might also have a look at the Xtend2 code. They will have solved the same problem there.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Previous Topic:Creating an unvalidated area of text
Next Topic:Error while validation
Goto Forum:
  


Current Time: Mon Dec 22 23:40:09 GMT 2014

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

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