public Context cloneWithExpectation(final JvmTypeReference newExpectation) { return new Context(newExpectation, this.classFinder, this.visibleFeatures, this.alreadyEvaluating); }
protected Object evaluate(final XExpression expression, final Context ctx) { Object _xifexpression = null; boolean _add = ctx.getAlreadyEvaluating().add(expression); if (_add) { Object _xtrycatchfinallyexpression = null; try { _xtrycatchfinallyexpression = this.internalEvaluate(expression, ctx); } finally { ctx.getAlreadyEvaluating().remove(expression); } _xifexpression = _xtrycatchfinallyexpression; } else { throw this.notConstantExpression(expression); } return _xifexpression; }
protected Object _internalEvaluate(final XNumberLiteral it, final Context ctx) { try { Number _xblockexpression = null; { Class<? extends Number> _xifexpression = null; JvmTypeReference _expectedType = ctx.getExpectedType(); boolean _tripleEquals = (_expectedType == null); if (_tripleEquals) { _xifexpression = this.numberLiterals.getJavaType(it); } else { Class<?> _javaType = this.getJavaType(ctx.getExpectedType().getType(), ctx.getClassFinder()); _xifexpression = ((Class<? extends Number>) _javaType); } final Class<? extends Number> type = _xifexpression; _xblockexpression = this.numberLiterals.numberValue(it, type); } return _xblockexpression; } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
boolean _contains = context.getAlreadyEvaluating().contains(expression); if (_contains) { throw new ConstantExpressionEvaluationException("Endless recursive evaluation detected."); final Map<String, JvmIdentifiableElement> visibleFeatures = this.findVisibleFeatures(expression); JvmTypeReference _type = field.getType(); ClassFinder _classFinder = context.getClassFinder(); Set<XExpression> _alreadyEvaluating = context.getAlreadyEvaluating(); final Context ctx = new Context(_type, _classFinder, visibleFeatures, _alreadyEvaluating); return this.evaluate(expression, ctx); } catch (final Throwable _t) {
protected Object _internalEvaluate(final XListLiteral it, final Context ctx) { try { JvmTypeReference _switchResult = null; JvmTypeReference _expectedType = ctx.getExpectedType(); final JvmTypeReference exp = _expectedType; boolean _matched = false; return this.evaluate(it_1, ctx.cloneWithExpectation(expectedComponentType)); }; final List<Object> elements = ListExtensions.<XExpression, Object>map(it.getElements(), _function); Class<?> _xifexpression = null; if ((expectedComponentType != null)) { _xifexpression = this.getJavaType(expectedComponentType.getType(), ctx.getClassFinder()); } else { Class<?> _xifexpression_1 = null;
protected Object _internalEvaluate(final XBinaryOperation it, final Context ctx) { Object _xblockexpression = null; { final Context context = ctx.cloneWithExpectation(null); final Object left = this.evaluate(it.getLeftOperand(), context); final Object right = this.evaluate(it.getRightOperand(), context); _xblockexpression = this.evaluateBinaryOperation(it, left, right); } return _xblockexpression; }
JvmTypeReference _expectedType = ctx.getExpectedType(); final JvmTypeReference it_1 = _expectedType; boolean _matched_1 = false; Map<String, JvmIdentifiableElement> _visibleFeatures = ctx.getVisibleFeatures(); final HashMap<String, JvmIdentifiableElement> copy = new HashMap<String, JvmIdentifiableElement>(_visibleFeatures); final Consumer<JvmEnumerationLiteral> _function = (JvmEnumerationLiteral it_2) -> { _xifexpression = ctx.getVisibleFeatures();
public Object evaluate(final XExpression it) { HashSet<XExpression> _newHashSet = CollectionLiterals.<XExpression>newHashSet(); Context _context = new Context(null, null, null, _newHashSet); return this.evaluate(it, _context); }
public Object evaluate(final XExpression expression, final JvmTypeReference expectedType) { final ClassLoader classLoader = this.classLoaderProvider.getClassLoader(expression); final Map<String, JvmIdentifiableElement> visibleFeatures = this.findVisibleFeatures(expression); JvmTypeReference _xifexpression = null; if ((expectedType instanceof XComputedTypeReference)) { _xifexpression = null; } else { _xifexpression = expectedType; } ClassFinder _classFinder = new ClassFinder(classLoader); LinkedHashSet<XExpression> _newLinkedHashSet = CollectionLiterals.<XExpression>newLinkedHashSet(); Context _context = new Context(_xifexpression, _classFinder, visibleFeatures, _newLinkedHashSet); final Object result = this.evaluate(expression, _context); return result; }