Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Scope Traversal
icon5.gif  Scope Traversal [message #827354] Fri, 23 March 2012 08:03
Kevin Sun is currently offline Kevin SunFriend
Messages: 32
Registered: August 2010
Location: China
Member

Does it cost a lot of time to traverse the nested scopes to access every EObjectDescriptions?

I want to support function overloading. My way is to get the scope calculated by the method "getScope" of "DefaultLinkingService". And then, try to match the parameters' type and the formals' type. The formals can be getten by accessing the method object's EObjectDescription in the scope.

So I have to go through the nested scope before "getSingleElement" is called by the "getLinkedObjects".

I found it is inefficient.

Who can help me on this problem?

----------------------------------------------------
my idea of supporting overloading of function
public List<EObject> getLinkedObjects(EObject context, EReference ref,
INode node) throws IllegalNodeException {

final String crossRefString = getCrossRefNodeAsString(node);
IScope potentialScope = getScope(context, ref);
if(isFunctionCall(potentialScope)){
potentialScope = getOverloadedFScope(potentialScope,node);
//I will go through the scope "potentialScope" here
}
final IScope scope = potentialScope;
IEObjectDescription description = scope.getSingleElement(qualifiedLinkName);
//...
}

[Updated on: Fri, 23 March 2012 08:26]

Report message to a moderator

Previous Topic:[Xtext 2.2.1] Simple conditional formatting?
Next Topic:Wiki-like Syntax
Goto Forum:
  


Current Time: Thu Apr 09 05:47:26 GMT 2020

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

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

Back to the top