@Test public void testBug457779_03() { final IFeatureCallArguments arguments = this.toArgumentsWithReceiver("String s, int[] i", "\"\""); final XExpression first = arguments.getArgument(0); Assert.assertNull(first); final LightweightTypeReference firstType = arguments.getDeclaredTypeForLambda(0); Assert.assertNull(firstType); final XExpression second = arguments.getArgument(1); Assert.assertTrue((second instanceof XStringLiteral)); final LightweightTypeReference secondType = arguments.getDeclaredTypeForLambda(1); String _simpleName = secondType.getSimpleName(); Assert.assertEquals("String", _simpleName); try { arguments.getArgument(2); Assert.fail("Expected exception"); } catch (final Throwable _t) { if (_t instanceof IndexOutOfBoundsException) { final IndexOutOfBoundsException expected = (IndexOutOfBoundsException) _t; } else { throw Exceptions.sneakyThrow(_t); } } try { arguments.getDeclaredTypeForLambda(2); Assert.fail("Expected exception"); } catch (final Throwable _t_1) { if (_t_1 instanceof IndexOutOfBoundsException) { final IndexOutOfBoundsException expected_1 = (IndexOutOfBoundsException) _t_1; } else { throw Exceptions.sneakyThrow(_t_1); } } }
@Test public void test_08() { final IFeatureCallArguments arguments = this.toArgumentsWithReceiver("String s, int i", "\"\", 1"); int _argumentCount = arguments.getArgumentCount(); Assert.assertEquals(3, _argumentCount); boolean _hasUnprocessedArguments = arguments.hasUnprocessedArguments(); Assert.assertTrue(_hasUnprocessedArguments); final IFeatureCallArgumentSlot firstSlot = arguments.getNextUnprocessedArgumentSlot(); boolean _isVarArg = firstSlot.isVarArg(); Assert.assertFalse(_isVarArg); boolean _isSuperfluous = firstSlot.isSuperfluous(); Assert.assertFalse(_isSuperfluous); XExpression _argumentExpression = firstSlot.getArgumentExpression(); Assert.assertTrue((_argumentExpression instanceof XStringLiteral)); LightweightTypeReference _declaredType = firstSlot.getDeclaredType(); String _simpleName = _declaredType.getSimpleName(); Assert.assertEquals("String", _simpleName); boolean _isProcessed = arguments.isProcessed(0); Assert.assertTrue(_isProcessed); boolean _isProcessed_1 = arguments.isProcessed(1); Assert.assertFalse(_isProcessed_1); firstSlot.markProcessed(); boolean _isProcessed_2 = arguments.isProcessed(1); Assert.assertTrue(_isProcessed_2); boolean _hasUnprocessedArguments_1 = arguments.hasUnprocessedArguments(); Assert.assertTrue(_hasUnprocessedArguments_1); final IFeatureCallArgumentSlot secondSlot = arguments.getNextUnprocessedArgumentSlot(); boolean _isVarArg_1 = secondSlot.isVarArg(); Assert.assertTrue(_isVarArg_1); boolean _isSuperfluous_1 = secondSlot.isSuperfluous(); Assert.assertFalse(_isSuperfluous_1); XExpression _argumentExpression_1 = secondSlot.getArgumentExpression(); Assert.assertTrue((_argumentExpression_1 instanceof XNumberLiteral)); LightweightTypeReference _declaredType_1 = secondSlot.getDeclaredType(); String _simpleName_1 = _declaredType_1.getSimpleName(); Assert.assertEquals("int", _simpleName_1); boolean _isProcessed_3 = arguments.isProcessed(2); Assert.assertFalse(_isProcessed_3); secondSlot.markProcessed(); boolean _isProcessed_4 = arguments.isProcessed(2); Assert.assertTrue(_isProcessed_4); boolean _hasUnprocessedArguments_2 = arguments.hasUnprocessedArguments(); Assert.assertFalse(_hasUnprocessedArguments_2); }
@Test public void test_03() { final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s", "\"\""); boolean _hasUnprocessedArguments = arguments.hasUnprocessedArguments(); Assert.assertTrue(_hasUnprocessedArguments); int _argumentCount = arguments.getArgumentCount(); Assert.assertEquals(1, _argumentCount); final IFeatureCallArgumentSlot singleSlot = arguments.getNextUnprocessedArgumentSlot(); boolean _isVarArg = singleSlot.isVarArg(); Assert.assertTrue(_isVarArg); boolean _isSuperfluous = singleSlot.isSuperfluous(); Assert.assertFalse(_isSuperfluous); XExpression _argumentExpression = singleSlot.getArgumentExpression(); Assert.assertTrue((_argumentExpression instanceof XStringLiteral)); LightweightTypeReference _declaredType = singleSlot.getDeclaredType(); String _simpleName = _declaredType.getSimpleName(); Assert.assertEquals("String", _simpleName); singleSlot.markProcessed(); boolean _hasUnprocessedArguments_1 = arguments.hasUnprocessedArguments(); Assert.assertFalse(_hasUnprocessedArguments_1); }
public LightweightTypeReference resolvesTo(final String expression, final String type) { try { final XExpression xExpression = this.expression(expression, false); Resource _eResource = xExpression.eResource(); EList<Diagnostic> _errors = _eResource.getErrors(); String _string = _errors.toString(); Resource _eResource_1 = xExpression.eResource(); EList<Diagnostic> _errors_1 = _eResource_1.getErrors(); boolean _isEmpty = _errors_1.isEmpty(); Assert.assertTrue(_string, _isEmpty); Resource _eResource_2 = xExpression.eResource(); EList<Diagnostic> _warnings = _eResource_2.getWarnings(); String _string_1 = _warnings.toString(); Resource _eResource_3 = xExpression.eResource(); EList<Diagnostic> _warnings_1 = _eResource_3.getWarnings(); boolean _isEmpty_1 = _warnings_1.isEmpty(); Assert.assertTrue(_string_1, _isEmpty_1); IBatchTypeResolver _typeResolver = this.getTypeResolver(); final IResolvedTypes resolvedTypes = _typeResolver.resolveTypes(xExpression); final LightweightTypeReference resolvedType = resolvedTypes.getActualType(xExpression); String _simpleName = resolvedType.getSimpleName(); Assert.assertEquals(type, _simpleName); TreeIterator<EObject> _eAllContents = xExpression.eAllContents(); Iterable<EObject> _iterable = IteratorExtensions.<EObject>toIterable(_eAllContents); for (final EObject content : _iterable) { boolean _matched = false; if (!_matched) { if (content instanceof XSwitchExpression) { final XSwitchExpression _xSwitchExpression = (XSwitchExpression) content; _matched = true; this.assertExpressionTypeIsResolved(_xSwitchExpression, resolvedTypes); String _localVarName = _xSwitchExpression.getLocalVarName(); boolean _notEquals = (!Objects.equal(_localVarName, null)); if (_notEquals) { this.assertIdentifiableTypeIsResolved(_xSwitchExpression, resolvedTypes); } } } if (!_matched) { if (content instanceof XAbstractFeatureCall) { final XAbstractFeatureCall _xAbstractFeatureCall = (XAbstractFeatureCall) content; _matched = true; this.assertExpressionTypeIsResolved(_xAbstractFeatureCall, resolvedTypes); XExpression _implicitReceiver = _xAbstractFeatureCall.getImplicitReceiver(); boolean _notEquals = (!Objects.equal(_implicitReceiver, null)); if (_notEquals) { XExpression _implicitReceiver_1 = _xAbstractFeatureCall.getImplicitReceiver(); this.assertExpressionTypeIsResolved(_implicitReceiver_1, resolvedTypes); } } } if (!_matched) { if (content instanceof XExpression) { final XExpression _xExpression = (XExpression) content; _matched = true; this.assertExpressionTypeIsResolved(_xExpression, resolvedTypes); } } if (!_matched) { if (content instanceof JvmIdentifiableElement) { final JvmIdentifiableElement _jvmIdentifiableElement = (JvmIdentifiableElement) content; _matched = true; this.assertIdentifiableTypeIsResolved(_jvmIdentifiableElement, resolvedTypes); } } } TreeIterator<EObject> _eAllContents_1 = xExpression.eAllContents(); Iterable<EObject> _iterable_1 = IteratorExtensions.<EObject>toIterable(_eAllContents_1); for (final EObject content_1 : _iterable_1) { boolean _matched_1 = false; if (!_matched_1) { if (content_1 instanceof XConstructorCall) { final XConstructorCall _xConstructorCall = (XConstructorCall) content_1; _matched_1 = true; Object _eGet = _xConstructorCall.eGet(Literals.XCONSTRUCTOR_CALL__CONSTRUCTOR, false); final InternalEObject constructor = ((InternalEObject) _eGet); String _string_2 = _xConstructorCall.toString(); Assert.assertNotNull(_string_2, constructor); String _string_3 = _xConstructorCall.toString(); boolean _eIsProxy = constructor.eIsProxy(); Assert.assertFalse(_string_3, _eIsProxy); } } if (!_matched_1) { if (content_1 instanceof XAbstractFeatureCall) { final XAbstractFeatureCall _xAbstractFeatureCall = (XAbstractFeatureCall) content_1; _matched_1 = true; Object _eGet = _xAbstractFeatureCall.eGet(Literals.XABSTRACT_FEATURE_CALL__FEATURE, false); final InternalEObject feature = ((InternalEObject) _eGet); String _string_2 = _xAbstractFeatureCall.toString(); Assert.assertNotNull(_string_2, feature); String _string_3 = _xAbstractFeatureCall.toString(); boolean _eIsProxy = feature.eIsProxy(); Assert.assertFalse(_string_3, _eIsProxy); XExpression _implicitReceiver = _xAbstractFeatureCall.getImplicitReceiver(); boolean _notEquals = (!Objects.equal(_implicitReceiver, null)); if (_notEquals) { XExpression _implicitReceiver_1 = _xAbstractFeatureCall.getImplicitReceiver(); Object _eGet_1 = _implicitReceiver_1.eGet(Literals.XABSTRACT_FEATURE_CALL__FEATURE, false); final InternalEObject implicitFeature = ((InternalEObject) _eGet_1); String _string_4 = implicitFeature.toString(); Assert.assertNotNull(_string_4, feature); String _string_5 = implicitFeature.toString(); boolean _eIsProxy_1 = feature.eIsProxy(); Assert.assertFalse(_string_5, _eIsProxy_1); } } } } Resource _eResource_4 = xExpression.eResource(); Iterable<Diagnostic> _linkingAndSyntaxErrors = this.getLinkingAndSyntaxErrors(_eResource_4); String _string_2 = _linkingAndSyntaxErrors.toString(); Resource _eResource_5 = xExpression.eResource(); Iterable<Diagnostic> _linkingAndSyntaxErrors_1 = this.getLinkingAndSyntaxErrors(_eResource_5); boolean _isEmpty_2 = IterableExtensions.isEmpty(_linkingAndSyntaxErrors_1); Assert.assertTrue(_string_2, _isEmpty_2); Resource _eResource_6 = xExpression.eResource(); EList<Diagnostic> _warnings_2 = _eResource_6.getWarnings(); String _string_3 = _warnings_2.toString(); Resource _eResource_7 = xExpression.eResource(); EList<Diagnostic> _warnings_3 = _eResource_7.getWarnings(); boolean _isEmpty_3 = _warnings_3.isEmpty(); Assert.assertTrue(_string_3, _isEmpty_3); return resolvedType; } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }