Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xbase] extending scope for XVariableDeclaration
[Xbase] extending scope for XVariableDeclaration [message #758702] Thu, 24 November 2011 10:06
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I'd like to have XVariableDeclarations also in other parts of my DSL
(just to give a possible scenario, say global variables), and I'd like
XExpressions to be able to refer to these variable declarations.

I guess I should extend (and inject) the XbaseScopeProvider.

In Xtext 2.0 documentation there was a paragraph about that

http://www.eclipse.org/Xtext/documentation/2_0_0/199d-xbase-expressions.php

"Populating the Scopes"

for the domainmodel example, but now that paragraph is gone in Xtext 2.1
documentation, and the domainmodel example does not have a custom scope
provider anymore (I guess because now things have changed using the
model inference).

So is it still the right way to override this method in XbaseScopeProvider?

protected IScope createLocalVarScope(IScope parentScope,
LocalVariableScopeContext scopeContext)

slightly related to this question: in the unit tests for the DSL, since
the custom scoping is not yet implemented I get failures (as expected)
using code like

@Inject ParseHelper<Model> parser

@Inject extension ValidationTestHelper

parser.parse(...my test model...).assertNoErrors

but the test fails with a WrappedException which also says something like

Caused by: java.lang.NoClassDefFoundError: org/eclipse/jdt/core/Flags

thus the actual linking error is kind of lost in the trace...

it this the expected behavior?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:[xtend2] filter() and class selection
Next Topic:Generation gap pattern and EcoreGenerator
Goto Forum:
  


Current Time: Thu Apr 18 09:27:21 GMT 2024

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

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

Back to the top