Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext is not validating return parameter type and also not recognizing the formal parameter(Language: The formal parameter passed is not available inside the method body and return type validation is missing)
Xtext is not validating return parameter type and also not recognizing the formal parameter [message #1239511] Tue, 04 February 2014 10:42 Go to next message
Priya Sabut is currently offline Priya SabutFriend
Messages: 41
Registered: September 2012
Member
Hi All,
I have a grammar which allows me to write function definition equivalent to java syntax. But surprisingly the formal parameters passed are not found within method body and also the return type is not getting validated!!

The grammar and the language is specified below::

Grammar:
---------
DomainModel:

functions += FunctionDeclare)*;
FunctionDeclare:
function = Function;
Function:
{Function}
type = JvmTypeReference name=QualifiedName '(' (params+=FullJvmFormalParameter (',' params+=FullJvmFormalParameter)*)? ')'
body=XBlockExpression;

Language:
---------
int getAbc(String c) {
val b= 1; // warning: The value of the local variable b is not used
var String a ="name"; // warning: The value of the local variable a is not used
return a;
}

Also these warnings are there even variable "a" is being used by return statement.

Do I need to write any sort of customization to make it work ? Please help...
Re: Xtext is not validating return parameter type and also not recognizing the formal parameter [message #1239528 is a reply to message #1239511] Tue, 04 February 2014 11:33 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
How did you implement jvmmodelinferrer? Have a look at the domain
model example

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 04 February 2014 12:39]

Report message to a moderator

Previous Topic:Xtext 2.5.1
Next Topic:Cannot add supertype X to sealed type Y
Goto Forum:
  


Current Time: Fri Dec 04 15:35:45 GMT 2020

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

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

Back to the top