Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364272

Summary: [parser] query resolution error
Product: [Modeling] Acceleo Reporter: Laurent Goubet <laurent.goubet>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: stephane.begaudeau
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 365556    

Description Laurent Goubet CLA 2011-11-21 04:19:13 EST
The following module fails to resolve the recursive calls to the "recurse" query. None of the recursive calls fail if the parameters are passed "within parenthesis" instead of prepending the first argument.

i.e; changing both calls to "recurse" from :
eClass.recurse(i + 1)
to
recurse(eClass, i + 1)

makes the resolution work.

The parser seems to ignore the first argument (variable) when using the first form (though the very first call, "eClass.recurse(0)" is properly resolved?).




[module testModule('http://www.eclipse.org/emf/2002/Ecore')/]

[template public main(eClass : EClass)]
	[comment @main/]
	[file (eClass.name + '.txt', false, 'UTF-8')]
		[eClass.recurse(0)/]
	[/file]
[/template]

[query public recurse(eClass : EClass, i : Integer) : String =
	if (i = 2)
	then 'world'
	else
		if (i = 1)
		then ',' + eClass.recurse(i + 1)
		else 'hello' + eClass.recurse(i + 1)
		endif
	endif/]
Comment 1 Stephane Begaudeau CLA 2012-04-11 05:16:57 EDT
A fix has been contributed on HEAD and R3_2_maintenance. An unit test has also been added to the test suite. It will be available for Acceleo 3.2.1 and 3.3.0.
Comment 2 Laurent Goubet CLA 2015-05-27 08:56:27 EDT
Closing resolved bugs