Package org.eclipse.xtext.xbase.interpreter

Examples of org.eclipse.xtext.xbase.interpreter.IEvaluationResult


                context.newValue(_create_1, _get);
                index = (index + 1);
              }
            }
            XBlockExpression _body = ((Executable)executable).getBody();
            final IEvaluationResult result = this.evaluate(_body, context, CancelIndicator.NullImpl);
            Throwable _exception = result.getException();
            boolean _notEquals = (!Objects.equal(_exception, null));
            if (_notEquals) {
              throw result.getException();
            }
            _xblockexpression_1 = result.getResult();
          }
          _xifexpression = _xblockexpression_1;
        } else {
          _xifexpression = super.invokeOperation(operation, receiver, argumentValues);
        }
View Full Code Here


      int index = 0;
      for (JvmFormalParameter p : m.getParameters()) {
        context.newValue(QualifiedName.create(p.getName()), argumentValues.get(index));
        index++;
      }
      IEvaluationResult result = evaluate(m.getBody(), context, indicator);
      if (result.getException() != null) {
        result.getException().printStackTrace();
        throw new EvaluationException(result.getException());
      }
      return result.getResult();
    } else {
      return super.invokeOperation(operation, receiver, argumentValues, c, indicator);
    }
  }
View Full Code Here

      if (monitor.isCanceled()) {
        System.out.println("mumu");
        monitor.done();
        return IterableExtensions.join(data, "\n");
      }
      IEvaluationResult result = xbaseInterpreter.evaluate(x, context, CancelIndicator.NullImpl);
      data.add(serializer.serialize(x).trim());
      if (result.getException() != null) {
        data.add("// Exception: " + result.getException().getMessage());
        result.getException().printStackTrace();
        return IterableExtensions.join(data, "\n");
      } else {
        if (result.getResult() == null) {
          data.add("// null");
        } else {
          data.add("//" + result.getResult().getClass().getSimpleName() + ": " + result.getResult().toString());
        }
      }
      monitor.worked(1);

    }
View Full Code Here

  }

  public Object execute(IEvaluationContext evaluationContext) throws ScriptExecutionException {
    if(xExpression!=null) {
        try {
          IEvaluationResult result = interpreter.evaluate(xExpression, evaluationContext, CancelIndicator.NullImpl);
          if(result==null) {
            // this can only happen on an InterpreterCancelledException, i.e. NEVER ;-)
            return null;
          }
          if (result.getException() != null) {
              throw new ScriptExecutionException(result.getException().getMessage(), result.getException());
          }
          return result.getResult();
        } catch(Throwable e) {
          if(e instanceof ScriptExecutionException) {
            throw (ScriptExecutionException) e;
          } else {
            throw new ScriptExecutionException("An error occured during the script execution: " + e.getMessage(), e);
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.xbase.interpreter.IEvaluationResult

Copyright © 2018 www.massapicom. 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.