Community
Participate
Working Groups
I wanted to traverses up a chain of Package objects, to compute the full name, and tried the following: [query public packageFullName(pack : Package, suffix : String) : String = if pack.oclIsUndefined() then suffix else packageFullName(pack._package, pack.name + '.' + suffix) endif /] If called on a chain of packages with names org.eclipse.tests it returns <undefined-object>.org.eclipse where <undefined-object> is the result of calling oclUndefined.toString(). It is as if the pack.name expression in pack.name + '.' + suffix is interpreted as pack._package.name. However, the following works: [query public packageFullName(pack : Package, suffix : String) : String = if pack.oclIsUndefined() then suffix else let suffix : String = pack.name + '.' + suffix in packageFullName(pack._package, suffix) endif /] I.e. the argument is computed before the recursive call to packageFullName. I cannot understand why the result should differ and be wrong in the first case.
New Gerrit change created: https://git.eclipse.org/r/69724
Gerrit change https://git.eclipse.org/r/69724 was merged to [master]. Commit: http://git.eclipse.org/c/acceleo/org.eclipse.acceleo.git/commit/?id=3b21655074aed2c171df0e5273421d140d1120b2