Skip to main content



      Home
Home » Modeling » TMF (Xtext) » implement "continue" and "break" with Xbase
implement "continue" and "break" with Xbase [message #1547643] Mon, 05 January 2015 10:04 Go to next message
Eclipse UserFriend
Hi

this is still related to the Xbase DSL I'm working on that should
reflect Java statements.

I'm implementing "continue" and "break"; I noted that under certain
conditions a basic for loop is translated into a Java while statement,
thus I'm customizing the Xbase compiler to deal with that.

From what I understand I should also customize the
DefaultEarlyExitComputer to check for dead code.

I have two doubts:

- does the use case of IEarlyExitComputer also consider cases for
branching statements like continue and break or is it used only for
statements that make the whole current method exit? From the comment in
the code I'd be tempted to say that it can't be used for branching
statements
- IEarlyExitComputer$ExitPoint has a protected constructor, which makes
it not instantiatable in a custom DefaultEarlyExitComputer; does that
mean that IEarlyExitComputer is not meant to be customized?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: implement "continue" and "break" with Xbase [message #1548953 is a reply to message #1547643] Tue, 06 January 2015 03:28 Go to previous message
Eclipse UserFriend
Hi Lorenzo,

the protected constructor is an oversight. This will be changed for 2.8.
The early exit computer is used to detect code that will not be
executed. Since there is no break / continue in Xbase, there is no
special kind of ExitPoint for those. You may want to create a subtype of
ExitPoint to implement that. In that sense, the early exit computer does
consider branching, but it was not necessary to add the logic for jump /
branch expressions. You may want to look into
EarlyExitValidator.checkDeadCode(XIfExpression) to see how that is
generally done wrt to special expressions and branching.

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:Maven plugin and incremental generation
Next Topic:Customize IQualifiedNameProvider Problem
Goto Forum:
  


Current Time: Mon Jul 14 14:43:41 EDT 2025

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

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

Back to the top