public boolean isOperatorFromExtension(XAbstractFeatureCall featureCall, QualifiedName operatorSymbol, Class<?> definingExtensionClass) { return isOperatorFromExtension(featureCall, featureCall.getConcreteSyntaxFeatureName(), operatorSymbol, definingExtensionClass); }
protected Object evaluateGetAndAssign(XAbstractFeatureCall featureCall, IEvaluationContext context, CancelIndicator indicator) { XAbstractFeatureCall operand = (XAbstractFeatureCall) featureCall.getActualArguments().get(0); Object originalValue = internalEvaluate(operand, context, indicator); Object value = applyGetAndAssignOperator(originalValue, featureCall.getConcreteSyntaxFeatureName()); assignValueTo(operand.getFeature(), featureCall, value, context, indicator); return originalValue; }
/** Check if the call is discouraged. * * <p>One example of a discouraged feature is {@link System#err}. * * @param expression the expression. */ @Check(CheckType.FAST) public void checkDiscouragedCalls(XAbstractFeatureCall expression) { if (!isIgnored(DISCOURAGED_REFERENCE) && this.featureCallValidator.isDiscouragedCall(expression)) { addIssue( MessageFormat.format(Messages.SARLValidator_37, expression.getConcreteSyntaxFeatureName()), expression, DISCOURAGED_REFERENCE); } }
protected void synthesizeIssuesForFollowUpErrors(Resource resource, List<Issue> result) { List<EObject> contents = resource.getContents(); if (!contents.isEmpty()) { IResolvedTypes resolvedTypes = typeResolver.resolveTypes(contents.get(0)); for(ILinkingCandidate linkingCandidate: resolvedTypes.getFollowUpErrors()) { XExpression expression = linkingCandidate.getExpression(); IssueImpl issue = new Issue.IssueImpl(); issue.setUriToProblem(EcoreUtil.getURI(linkingCandidate.getExpression())); if (expression instanceof XAbstractFeatureCall) issue.setMessage(((XAbstractFeatureCall) expression).getConcreteSyntaxFeatureName() + " cannot be resolved"); else { List<INode> nodes = NodeModelUtils.findNodesForFeature(expression, XbasePackage.Literals.XCONSTRUCTOR_CALL__CONSTRUCTOR); if (nodes.size() >= 1) { issue.setMessage(nodes.get(0).getText() + " cannot be resolved"); } } result.add(issue); } } }
/** Get the string representation of an operator. * * @param call the call to the operator feature. * @return the string representation of the operator or {@code null} if not a valid operator. */ protected String getOperatorSymbol(XAbstractFeatureCall call) { if (call != null) { final Resource res = call.eResource(); if (res instanceof StorageAwareResource) { final boolean isLoadedFromStorage = ((StorageAwareResource) res).isLoadedFromStorage(); if (isLoadedFromStorage) { final QualifiedName operator = getOperatorMapping().getOperator( QualifiedName.create(call.getFeature().getSimpleName())); return Objects.toString(operator); } } return call.getConcreteSyntaxFeatureName(); } return null; }
protected String getOperator(final XAbstractFeatureCall call) { String _switchResult = null; Resource _eResource = call.eResource(); final Resource res = _eResource; boolean _matched = false; if (res instanceof StorageAwareResource) { boolean _isLoadedFromStorage = ((StorageAwareResource)res).isLoadedFromStorage(); if (_isLoadedFromStorage) { _matched=true; QualifiedName _operator = this.operatorMapping.getOperator(QualifiedName.create(call.getFeature().getSimpleName())); String _string = null; if (_operator!=null) { _string=_operator.toString(); } return _string; } } if (!_matched) { _switchResult = call.getConcreteSyntaxFeatureName(); } return _switchResult; }
@Override protected boolean highlightElement(EObject object, IHighlightedPositionAcceptor acceptor, CancelIndicator cancelIndicator) { if (object instanceof XAbstractFeatureCall) { if (((XAbstractFeatureCall) object).isPackageFragment()) { return true; } if (SPECIAL_FEATURE_NAMES.contains(((XAbstractFeatureCall) object).getConcreteSyntaxFeatureName())) { return false; } operationCanceledManager.checkCanceled(cancelIndicator); computeFeatureCallHighlighting((XAbstractFeatureCall) object, acceptor); } else if (object instanceof JvmTypeParameter) { highlightTypeParameter((JvmTypeParameter) object, acceptor); } else if (object instanceof JvmFormalParameter) { highlightFormalParameter((JvmFormalParameter) object, acceptor); } else if (object instanceof XVariableDeclaration) { highlightVariableDeclaration((XVariableDeclaration) object, acceptor); } else if (object instanceof XNumberLiteral) { highlightNumberLiterals((XNumberLiteral) object, acceptor); } else if (object instanceof XConstructorCall) { highlightConstructorCall((XConstructorCall) object, acceptor); } else if (object instanceof XAnnotation) { // Handle XAnnotation in a special way because we want the @ highlighted too highlightAnnotation((XAnnotation) object, acceptor); } else { computeReferencedJvmTypeHighlighting(acceptor, object, cancelIndicator); } return false; }
name = featureNameProvider.getSimpleName(calledFeature); } else { name = featureCall.getConcreteSyntaxFeatureName();
XExpression leftOperand = ((XBinaryOperation)featureCall).getLeftOperand(); Object result = internalEvaluate(leftOperand, context, indicator); String operatorName = featureCall.getConcreteSyntaxFeatureName(); if (equal(expressionHelper.getElvisOperator() ,operatorName)) { if(result != null)
throw new ScriptExecutionException(_scriptError_1); } else { String _concreteSyntaxFeatureName_2 = featureCall.getConcreteSyntaxFeatureName(); String _plus_6 = ("Unknown variable or command \'" + _concreteSyntaxFeatureName_2); String _plus_7 = (_plus_6 + "\'");
XExpression target = memberFeatureCall.getMemberCallTarget(); if (target instanceof XAbstractFeatureCall && SUPER.getFirstSegment().equals(((XAbstractFeatureCall) target).getConcreteSyntaxFeatureName())) { JvmIdentifiableElement targetFeature = ((XAbstractFeatureCall) target).getFeature(); String message = String.format("Cannot directly invoke the abstract method %s%s of the type %s",