Skip to content

Commit

Permalink
[lang] Do not generate inline for variadic functions.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Jun 23, 2016
1 parent a0774ff commit 4fd08e5
Showing 1 changed file with 6 additions and 7 deletions.
Expand Up @@ -1560,7 +1560,8 @@ protected void transform(SarlCapacityUses source, JvmGenericType container) {
MessageFormat.format(
Messages.SARLJvmModelInferrer_13,
hyperrefLink));
operation.setVarArgs(entry.getValue().isVarArgs());
final boolean isVarArgs = entry.getValue().isVarArgs();
operation.setVarArgs(isVarArgs);

// Exceptions
for (JvmTypeReference exception : entry.getValue().getExceptions()) {
Expand All @@ -1586,12 +1587,10 @@ protected void transform(SarlCapacityUses source, JvmGenericType container) {
translateAnnotationsTo(source.getAnnotations(), operation);

// Add the inline annotation
/* TODO: The inline may cause problems due to type argument.
* Indeed, when the capacity function should take a Class, it could
* be written "TypeName" or "typeof(TypeName)". Both expressions
* are not valid Java expressions.
*/
if (!Utils.hasAnnotation(operation, Inline.class)) {
// The Xtext inline evaluator is considering the function arguments, not the
// function formal parameters. Consequently, inline cannot be used for functions
// with variadic parameters.
if (!isVarArgs && !Utils.hasAnnotation(operation, Inline.class)) {
JvmDeclaredType declaringType = entry.getValue().getDeclaringType();
StringBuilder it = new StringBuilder();
it.append("getSkill("); //$NON-NLS-1$
Expand Down

0 comments on commit 4fd08e5

Please sign in to comment.