Examples of ITreeAppendable


Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

        _builder_1.append(_declareVariable, " ");
        _builder_1.append(" : ");
        it.append(_builder_1);
        XExpression _forExpression_1 = ((RichStringForLoop)expr).getForExpression();
        this.internalToJavaExpression(_forExpression_1, it);
        ITreeAppendable _append = it.append(") {");
        _append.increaseIndentation();
        XExpression _eachExpression = ((RichStringForLoop)expr).getEachExpression();
        this.internalToJavaStatement(_eachExpression, it, true);
        it.newLine();
        StringConcatenation _builder_2 = new StringConcatenation();
        _builder_2.append(name, "");
        _builder_2.append(".append(");
        it.append(_builder_2);
        XExpression _eachExpression_1 = ((RichStringForLoop)expr).getEachExpression();
        this.internalToJavaExpression(_eachExpression_1, it);
        it.append(");");
        ITreeAppendable _decreaseIndentation = it.decreaseIndentation();
        ITreeAppendable _newLine = _decreaseIndentation.newLine();
        _newLine.append("}");
      }
    }
    if (!_matched) {
      super.doInternalToJavaStatement(expr, it, isReferenced);
    }
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

    }
    return _xblockexpression;
  }
 
  public ITreeAppendable generateUnsupportedOperationException(final EObject problem, final ITreeAppendable appendable) {
    ITreeAppendable _append = appendable.append("throw new UnsupportedOperationException(\"Test wouldn\'t compile, due to missing or erroneous code.\");");
    return _append;
  }
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

        final Procedure1<ITreeAppendable> _function_1 = new Procedure1<ITreeAppendable>() {
          public void apply(final ITreeAppendable it) {
            it.append("return new ");
            JvmTypeReference _jvmType = JexTestJvmModelInferrer.this._util.jvmType(instance);
            JexTestJvmModelInferrer.this._typeReferenceSerializer.serialize(_jvmType, instance, it);
            ITreeAppendable _append = it.append("();");
            _append.newLine();
          }
        };
        this._jvmTypesBuilder.setBody(method, _function_1);
      } else {
        if (this.checkDiagnosticInCompiler) {
          XExpression _expr_1 = instance.getExpr();
          this._jvmTypesBuilder.setBody(method, _expr_1);
        } else {
          final Procedure1<ITreeAppendable> _function_2 = new Procedure1<ITreeAppendable>() {
            public void apply(final ITreeAppendable it) {
              XExpression _expr = instance.getExpr();
              boolean _hasDiagnostic = JexTestJvmModelInferrer.this._util.hasDiagnostic(_expr);
              if (_hasDiagnostic) {
                XExpression _expr_1 = instance.getExpr();
                JexTestJvmModelInferrer.this._util.generateUnsupportedOperationException(_expr_1, it);
              } else {
                XExpression _expr_2 = instance.getExpr();
                JexTestJvmModelInferrer.this._xbaseCompiler.toJavaExpression(_expr_2, it);
                it.append("return ");
                XExpression _expr_3 = instance.getExpr();
                JexTestJvmModelInferrer.this._xbaseCompiler.toJavaExpression(_expr_3, it);
                ITreeAppendable _append = it.append(";");
                _append.newLine();
              }
            }
          };
          this._jvmTypesBuilder.setBody(method, _function_2);
        }
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

      }
    }
  }
 
  public ITreeAppendable generateSetUpMethodBody(final JexTestCase testCase, final ITreeAppendable appendable) {
    ITreeAppendable _xifexpression = null;
    boolean _isDefaultInstanceTest = this._util.isDefaultInstanceTest(testCase);
    if (_isDefaultInstanceTest) {
      ITreeAppendable _xblockexpression = null;
      {
        StringConcatenation _builder = new StringConcatenation();
        String _defaultInstanceName = this._util.defaultInstanceName(testCase);
        _builder.append(_defaultInstanceName, "");
        _builder.append(" = new ");
        appendable.append(_builder);
        JvmParameterizedTypeReference _defaultInstanceType = this._util.defaultInstanceType(testCase);
        this._typeReferenceSerializer.serialize(_defaultInstanceType, testCase, appendable);
        ITreeAppendable _append = appendable.append("();");
        ITreeAppendable _newLine = _append.newLine();
        _xblockexpression = (_newLine);
      }
      _xifexpression = _xblockexpression;
    } else {
      EList<Instance> _instances = testCase.getInstances();
      for (final Instance instance : _instances) {
        StringConcatenation _builder = new StringConcatenation();
        String _name = instance.getName();
        _builder.append(_name, "");
        _builder.append(" = _init_");
        String _name_1 = instance.getName();
        _builder.append(_name_1, "");
        _builder.append("();");
        ITreeAppendable _append = appendable.append(_builder);
        _append.newLine();
      }
    }
    return _xifexpression;
  }
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

 
  public void inferStateTestMethods(final StateTestContext stateTestContext, final State state, final JvmGenericType jvmClass) {
    EList<JvmMember> _members = jvmClass.getMembers();
    final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
      public void apply(final ITreeAppendable it) {
        final ITreeAppendable appendable = it;
        EList<ObjectTest> _objectTests = state.getObjectTests();
        final Procedure1<ObjectTest> _function = new Procedure1<ObjectTest>() {
          public void apply(final ObjectTest it) {
            XBlockExpression _test = it.getTest();
            JexTestJvmModelInferrer.this.generateTestHelperMethodCall("_test_", _test, appendable);
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

    }
    return _xblockexpression;
  }
 
  public ITreeAppendable generateTestHelperMethodCall(final String prefix, final EObject eObject, final ITreeAppendable appendable, final boolean asStatement, final boolean newline) {
    ITreeAppendable _xblockexpression = null;
    {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append(prefix, "");
      String _relativeName = this._util.<StateTestContext>relativeName(eObject, StateTestContext.class);
      _builder.append(_relativeName, "");
      _builder.append("(");
      appendable.append(_builder);
      final String instanceName = this._util.instanceName(eObject);
      String separator = "";
      boolean _notEquals = (!Objects.equal(instanceName, null));
      if (_notEquals) {
        appendable.append(instanceName);
        separator = ", ";
      }
      StateTestContext stateTestContext = this._util.<StateTestContext>ancestor(eObject, StateTestContext.class);
      if ((stateTestContext instanceof StateFunction)) {
        EList<Parameter> _parameters = ((StateFunction) stateTestContext).getParameters();
        final Function1<Parameter,String> _function = new Function1<Parameter,String>() {
          public String apply(final Parameter it) {
            String _name = it.getName();
            return _name;
          }
        };
        String _join = IterableExtensions.<Parameter>join(_parameters, separator, ", ", "", _function);
        appendable.append(_join);
        StateTestContext _ancestor = this._util.<StateTestContext>ancestor(stateTestContext, StateTestContext.class);
        stateTestContext = _ancestor;
      }
      if ((stateTestContext instanceof JexTestSequence)) {
        EList<Instance> _instances = ((JexTestSequence) stateTestContext).getInstances();
        final Function1<Instance,String> _function_1 = new Function1<Instance,String>() {
          public String apply(final Instance it) {
            String _name = it.getName();
            return _name;
          }
        };
        String _join_1 = IterableExtensions.<Instance>join(_instances, separator, ", ", "", _function_1);
        appendable.append(_join_1);
      }
      appendable.append(")");
      if (asStatement) {
        appendable.append(";");
      }
      ITreeAppendable _xifexpression = null;
      if (newline) {
        ITreeAppendable _newLine = appendable.newLine();
        _xifexpression = _newLine;
      }
      _xblockexpression = (_xifexpression);
    }
    return _xblockexpression;
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

    }
    return _xblockexpression;
  }
 
  public ITreeAppendable generateTestHelperMethodCall(final String prefix, final EObject eObject, final ITreeAppendable appendable) {
    ITreeAppendable _generateTestHelperMethodCall = this.generateTestHelperMethodCall(prefix, eObject, appendable, true, true);
    return _generateTestHelperMethodCall;
  }
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

    ITreeAppendable _generateTestHelperMethodCall = this.generateTestHelperMethodCall(prefix, eObject, appendable, true, true);
    return _generateTestHelperMethodCall;
  }
 
  public ITreeAppendable generateLocalInstance(final Instance instance, final ITreeAppendable appendable) {
    ITreeAppendable _xblockexpression = null;
    {
      final JvmTypeReference instanceType = this._util.jvmType(instance);
      this._typeReferenceSerializer.serialize(instanceType, instance, appendable);
      StringConcatenation _builder = new StringConcatenation();
      _builder.append(" ");
      String _name = instance.getName();
      _builder.append(_name, " ");
      _builder.append(" = _init_");
      String _relativeName = this._util.<JexTestSequence>relativeName(instance, JexTestSequence.class);
      _builder.append(_relativeName, " ");
      _builder.append("();");
      appendable.append(_builder);
      ITreeAppendable _newLine = appendable.newLine();
      _xblockexpression = (_newLine);
    }
    return _xblockexpression;
  }
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

    }
    return _xblockexpression;
  }
 
  public ITreeAppendable generateStateTesterCall(final State state, final State stateRef, final ITreeAppendable appendable) {
    ITreeAppendable _xblockexpression = null;
    {
      State theState = state;
      boolean _equals = Objects.equal(theState, null);
      if (_equals) {
        theState = stateRef;
      }
      ITreeAppendable _xifexpression = null;
      boolean _notEquals = (!Objects.equal(theState, null));
      if (_notEquals) {
        ITreeAppendable _generateTestHelperMethodCall = this.generateTestHelperMethodCall("_test_", theState, appendable);
        _xifexpression = _generateTestHelperMethodCall;
      }
      _xblockexpression = (_xifexpression);
    }
    return _xblockexpression;
View Full Code Here

Examples of org.eclipse.xtext.xbase.compiler.output.ITreeAppendable

  }
 
  protected void _generateTransitionActionsEffect(final TransitionExceptionEffect effect, final Transition transition, final ITreeAppendable appendable) {
    TransitionEffect _effect = transition.getEffect();
    if ((_effect instanceof TransitionExceptionEffect)) {
      ITreeAppendable _append = appendable.append("try {");
      ITreeAppendable _increaseIndentation = _append.increaseIndentation();
      _increaseIndentation.newLine();
    }
    this._generateTransitionActionsEffect(((TransitionEffect) effect), transition, appendable);
    TransitionEffect _effect_1 = transition.getEffect();
    if ((_effect_1 instanceof TransitionExceptionEffect)) {
      TransitionEffect _effect_2 = transition.getEffect();
      final JvmParameterizedTypeReference exceptionClass = ((TransitionExceptionEffect) _effect_2).getExceptionClass();
      String _qualifiedName = exceptionClass.getQualifiedName();
      final String exceptionClassName = this._util.removeJavaLang(_qualifiedName);
      StringConcatenation _builder = new StringConcatenation();
      _builder.append(exceptionClassName, "");
      _builder.append(" should be thrown after ");
      EList<TransitionAction> _actions = transition.getActions();
      String _asSourceText = this._util.asSourceText(_actions, ", ");
      _builder.append(_asSourceText, "");
      final String message = _builder.toString();
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("fail(\"");
      String _quote = this._util.quote(message, "\"");
      _builder_1.append(_quote, "");
      _builder_1.append("\");");
      appendable.append(_builder_1);
      ITreeAppendable _decreaseIndentation = appendable.decreaseIndentation();
      ITreeAppendable _newLine = _decreaseIndentation.newLine();
      _newLine.append("}");
      String exceptionVar = appendable.declareSyntheticVariable(transition, "e");
      StringConcatenation _builder_2 = new StringConcatenation();
      _builder_2.append(" ");
      _builder_2.append("catch (Exception ");
      _builder_2.append(exceptionVar, " ");
      _builder_2.append(") {");
      ITreeAppendable _append_1 = appendable.append(_builder_2);
      ITreeAppendable _increaseIndentation_1 = _append_1.increaseIndentation();
      _increaseIndentation_1.newLine();
      StringConcatenation _builder_3 = new StringConcatenation();
      _builder_3.append("assertTrue(\"");
      String _quote_1 = this._util.quote(message, "\"");
      _builder_3.append(_quote_1, "");
      _builder_3.append("\", ");
      _builder_3.append(exceptionVar, "");
      _builder_3.append(" instanceof ");
      _builder_3.append(exceptionClassName, "");
      _builder_3.append(");");
      appendable.append(_builder_3);
      ITreeAppendable _decreaseIndentation_1 = appendable.decreaseIndentation();
      ITreeAppendable _newLine_1 = _decreaseIndentation_1.newLine();
      ITreeAppendable _append_2 = _newLine_1.append("}");
      _append_2.newLine();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.