public bool TryConvertFrom(TemplateContext context, SourceSpan span, object value) { if (value is IScriptTransformable valuable) { if (!CanTransform(valuable)) { throw new ScriptRuntimeException(span, $"Cannot transform the value `{value}` between the element type `{valuable.ElementType.ScriptPrettyName()}` and the target function `{ElementType.ScriptPrettyName()}`."); } Transformable = valuable; } else { Value = Accept(context, span, value); } return(true); }
public KalkCompositeValue(IScriptTransformable transformable) { Transformable = transformable; }
protected override bool CanTransform(IScriptTransformable valuable) { return(valuable.CanTransform(typeof(int))); }
public KalkCompositeValue(object value) { Transformable = value as IScriptTransformable; Value = Transformable == null ? value : null; }
public KalkTrigDoubleValue(IScriptTransformable transformable) : base(transformable) { }
protected virtual bool CanTransform(IScriptTransformable valuable) { return(true); }