@Override protected List<XExpression> getArguments() { return getConstructorCall().getArguments(); }
@Override protected List<XExpression> getArguments() { return getConstructorCall().getArguments(); }
@Override protected List<XExpression> getArguments() { return getConstructorCall().getArguments(); }
@Override protected List<XExpression> getArguments() { return getConstructorCall().getArguments(); }
private List<XExpression> getActualArguments(XConstructorCall expr) { final List<XExpression> actualArguments = expr.getArguments(); return Lists.transform(actualArguments, it -> normalizeBlockExpression(it)); }
public String arguments(XConstructorCall constructorCall) { return "(" + expressionTypes(constructorCall.getArguments()) + ")"; }
/** Test if the given expression has side effects. * * @param expression the expression. * @param context the list of context expressions. * @return {@code true} if the expression has side effects. */ protected Boolean _hasSideEffects(XConstructorCall expression, ISideEffectContext context) { for (final XExpression ex : expression.getArguments()) { if (hasSideEffects(ex, context)) { return true; } } return false; }
protected Collection<IEarlyExitComputer.ExitPoint> _exitPoints(final XConstructorCall expression) { EList<XExpression> _arguments = expression.getArguments(); for (final XExpression argument : _arguments) { { Collection<IEarlyExitComputer.ExitPoint> argumentExitPoints = this.getExitPoints(argument); boolean _isNotEmpty = this.isNotEmpty(argumentExitPoints); if (_isNotEmpty) { return argumentExitPoints; } } } return Collections.<IEarlyExitComputer.ExitPoint>emptyList(); }
@Check public void checkExplicitOperationCall(XConstructorCall constructorCall) { if (!constructorCall.isExplicitConstructorCall() && constructorCall.getArguments().isEmpty()) { addIssue("Constructor call without parentheses", constructorCall, OPERATION_WITHOUT_PARENTHESES); } }
protected Object _doEvaluate(XConstructorCall constructorCall, IEvaluationContext context, CancelIndicator indicator) { JvmConstructor jvmConstructor = constructorCall.getConstructor(); List<Object> arguments = evaluateArgumentExpressions(jvmConstructor, constructorCall.getArguments(), context, indicator); Constructor<?> constructor = javaReflectAccess.getConstructor(jvmConstructor); try { if (constructor == null) throw new NoSuchMethodException("Could not find constructor " + jvmConstructor.getIdentifier()); constructor.setAccessible(true); Object result = constructor.newInstance(arguments.toArray(new Object[arguments.size()])); return result; } catch (InvocationTargetException targetException) { throw new EvaluationException(targetException.getTargetException()); } catch (Exception e) { throw new IllegalStateException("Could not invoke constructor: " + jvmConstructor.getIdentifier(), e); } }
@Override public void applyToComputationState() { for(XExpression argument: getConstructorCall().getArguments()) { state.withNonVoidExpectation().computeTypes(argument); } }
protected void _toJavaStatement(final XConstructorCall expr, ITreeAppendable b, final boolean isReferenced) { for (XExpression arg : expr.getArguments()) { prepareExpression(arg, b); } if (!isReferenced) { b.newLine(); constructorCallToJavaExpression(expr, b); b.append(";"); } else if (isVariableDeclarationRequired(expr, b, true)) { Later later = new Later() { @Override public void exec(ITreeAppendable appendable) { constructorCallToJavaExpression(expr, appendable); } }; declareFreshLocalVariable(expr, b, later); } }
protected boolean _isMultiParamInOwnLine(final XConstructorCall fc, final FormattableDocument doc) { final ILeafNode closingBracket = this._nodeModelAccess.nodeForKeyword(fc, ")"); HiddenLeafs _hiddenLeafsBefore = null; if (closingBracket!=null) { _hiddenLeafsBefore=this._hiddenLeafAccess.getHiddenLeafsBefore(closingBracket); } boolean _tripleNotEquals = (_hiddenLeafsBefore != null); if (_tripleNotEquals) { int _newLines = this._hiddenLeafAccess.getHiddenLeafsBefore(closingBracket).getNewLines(); return (_newLines > 0); } final Iterable<XExpression> params = this.explicitParams(fc.getArguments()); return ((IterableExtensions.size(params) > 1) && this.isEachExpressionInOwnLine(params)); }
/** * Syntax: '('* */ @Override protected void emit_XParenthesizedExpression_LeftParenthesisKeyword_0_a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { Keyword kw = grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0(); if (nodes == null) { if (semanticObject instanceof XIfExpression || semanticObject instanceof XTryCatchFinallyExpression) { EObject cnt = semanticObject.eContainer(); if (cnt instanceof XExpression && !(cnt instanceof XBlockExpression) && !(cnt instanceof XForLoopExpression)) acceptUnassignedKeyword(kw, kw.getValue(), null); } if (semanticObject instanceof XConstructorCall) { XConstructorCall call = (XConstructorCall) semanticObject; if (!call.isExplicitConstructorCall() && call.getArguments().isEmpty()) { acceptUnassignedKeyword(kw, kw.getValue(), null); } } } acceptNodes(transition, nodes); }
/** * Syntax: '('* */ @Override protected void emit_XParenthesizedExpression_LeftParenthesisKeyword_0_a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { Keyword kw = grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0(); if (nodes == null) { if (semanticObject instanceof XIfExpression || semanticObject instanceof XTryCatchFinallyExpression) { EObject cnt = semanticObject.eContainer(); if (cnt instanceof XExpression && !(cnt instanceof XBlockExpression) && !(cnt instanceof XForLoopExpression)) acceptUnassignedKeyword(kw, kw.getValue(), null); } if (semanticObject instanceof XConstructorCall) { XConstructorCall call = (XConstructorCall) semanticObject; if (!call.isExplicitConstructorCall() && call.getArguments().isEmpty()) { acceptUnassignedKeyword(kw, kw.getValue(), null); } } } acceptNodes(transition, nodes); }
/** Generate the given object. * * @param anonClass the anonymous class. * @param it the target for the generated content. * @param context the context. * @return the class definition. */ protected XExpression _generate(AnonymousClass anonClass, IAppendable it, IExtraLanguageGeneratorContext context) { if (it.hasName(anonClass)) { appendReturnIfExpectedReturnedExpression(it, context); it.append(it.getName(anonClass)).append("("); //$NON-NLS-1$ boolean firstArg = true; for (final XExpression arg : anonClass.getConstructorCall().getArguments()) { if (firstArg) { firstArg = false; } else { it.append(", "); //$NON-NLS-1$ } generate(arg, it, context); } it.append(")"); //$NON-NLS-1$ } return anonClass; }
nameClashResolver.resolveNameClashes(inferredType); final XConstructorCall constructorCall = anonymousClass.getConstructorCall(); for (XExpression actualParameter : constructorCall.getArguments()) { associator.associateLogicalContainer(actualParameter, container);
} else if (expression instanceof XConstructorCall) { XConstructorCall constructorCall = (XConstructorCall) expression; for (XExpression arg : constructorCall.getArguments()) { if (!this.internalCanCompileToJavaExpression(arg, appendable)) { return false;
@Override protected void _toJavaStatement(final XConstructorCall expr, ITreeAppendable b, final boolean isReferenced) { for (XExpression arg : expr.getArguments()) { prepareExpression(arg, b);
}; format.prepend(open, _function_3); this.formatFeatureCallParams(expr.getArguments(), open, close, format);