Java Code Examples for org.eclipse.xtext.xbase.XForLoopExpression#getDeclaredParam()
The following examples show how to use
org.eclipse.xtext.xbase.XForLoopExpression#getDeclaredParam() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SARLFormatter.java From sarl with Apache License 2.0 | 6 votes |
@Override protected void _format(XForLoopExpression expr, IFormattableDocument document) { final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(expr); document.append(regionFor.keyword(this.keywords.getForKeyword()), ONE_SPACE); final JvmFormalParameter declaredParam = expr.getDeclaredParam(); document.prepend(declaredParam, NO_SPACE); document.append(declaredParam, ONE_SPACE); document.format(declaredParam); final XExpression forExpression = expr.getForExpression(); document.prepend(forExpression, ONE_SPACE); document.append(forExpression, NO_SPACE); document.format(forExpression); final XExpression eachExpression = expr.getEachExpression(); if (eachExpression != null) { formatBody(eachExpression, true, document); } else { document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); } }
Example 2
Source File: XbaseTypeComputer.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void _computeTypes(final XForLoopExpression object, final ITypeComputationState state) { JvmFormalParameter declaredParam = object.getDeclaredParam(); ITypeComputationState eachState = state.withoutExpectation(); if (declaredParam != null) { LightweightTypeReference parameterType = computeForLoopParameterType(object, state); eachState = assignType(declaredParam, parameterType, eachState); eachState.withinScope(object); } eachState.computeTypes(object.getEachExpression()); LightweightTypeReference primitiveVoid = getPrimitiveVoid(state); state.acceptActualType(primitiveVoid); }
Example 3
Source File: ParserTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void testExtensionOnForLoopParam_01() throws Exception { XtendClass clazz = clazz("class Foo { def void m() { for(extension i: 1..2) {} } }"); assertEquals(1, clazz.getMembers().size()); XtendFunction m = (XtendFunction) clazz.getMembers().get(0); XBlockExpression body = (XBlockExpression) m.getExpression(); assertEquals(1, body.getExpressions().size()); XForLoopExpression forLoop = (XForLoopExpression) body.getExpressions().get(0); XtendFormalParameter parameter = (XtendFormalParameter) forLoop.getDeclaredParam(); assertTrue(parameter.isExtension()); }
Example 4
Source File: XbaseCompiler.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected JvmTypeReference getForLoopParameterType(XForLoopExpression expr) { JvmFormalParameter declaredParam = expr.getDeclaredParam(); return getParameterType(declaredParam); }