Exemplo n.º 1
0
 internal WorkerThread(CodeAssembly asm)
 {
     Assembly = asm;
     Module = asm.GetRootModule();
     CallStack = new CallStack();
     Context = new ExecutionContext();
 }
Exemplo n.º 2
0
        protected override ElaValue Convert(ElaValue @this, ElaTypeInfo type, ExecutionContext ctx)
        {
            if (type.ReflectedTypeCode == ElaTypeCode.String)
                return new ElaValue(Value.ToString());

            ctx.ConversionFailed(@this, type.ReflectedTypeName);
            return Default();
        }
Exemplo n.º 3
0
        protected override bool NotEqual(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            var lg = left.As<ElaGuid>();
            var rg = right.As<ElaGuid>();

            if (lg != null && rg != null)
                return lg.Value != rg.Value;
            else if (lg != null)
                return right.NotEqual(left, right, ctx);

            return true;
        }
Exemplo n.º 4
0
 protected override string Show(ElaValue @this, ShowInfo info, ExecutionContext ctx)
 {
     return !String.IsNullOrEmpty(info.Format) ? Value.ToString(info.Format) :
         Value.ToString();
 }
Exemplo n.º 5
0
        protected override ElaValue GetValue(ElaValue index, ExecutionContext ctx)
        {
            var val = default(ElaValue);

            if (!Map.TryGetValue(index, out val))
            {
                ctx.Fail(NOKEY, String.Format("An element with a key '{0}' doesn't exist.", index));
                return Default();
            }

            return val;
        }
Exemplo n.º 6
0
 //protected override void SetValue(ElaValue index, ElaValue value, ExecutionContext ctx)
 //{
 //    if (Map.ContainsKey(index))
 //        Map.Add(index, value);
 //    else
 //        Map[index] = value;
 //}
 protected override ElaValue GetLength(ExecutionContext ctx)
 {
     return new ElaValue(Map.Count);
 }
Exemplo n.º 7
0
 protected override string Show(ElaValue @this, ShowInfo info, ExecutionContext ctx)
 {
     return new ElaValue(ConvertToRecord()).Show(info, ctx);
 }