Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public KalkCompositeValue(IScriptTransformable transformable)
 {
     Transformable = transformable;
 }
Exemplo n.º 3
0
 protected override bool CanTransform(IScriptTransformable valuable)
 {
     return(valuable.CanTransform(typeof(int)));
 }
Exemplo n.º 4
0
 public KalkCompositeValue(object value)
 {
     Transformable = value as IScriptTransformable;
     Value         = Transformable == null ? value : null;
 }
Exemplo n.º 5
0
 public KalkTrigDoubleValue(IScriptTransformable transformable) : base(transformable)
 {
 }
Exemplo n.º 6
0
 protected virtual bool CanTransform(IScriptTransformable valuable)
 {
     return(true);
 }