internal ElaValue GetField(ElaValue index, ExecutionContext ctx) { if (vm != null) { if (index.TypeId != ElaMachine.STR) { ctx.InvalidType(TCF.GetShortForm(ElaTypeCode.String), index); return(Default()); } var field = index.DirectGetString(); var frame = vm.Assembly.GetModule(Handle); ScopeVar sc; if (!frame.GlobalScope.Locals.TryGetValue(field, out sc)) { ctx.UnknownField(index.DirectGetString(), new ElaValue(this)); return(Default()); } if ((sc.Flags & ElaVariableFlags.Private) == ElaVariableFlags.Private) { ctx.Fail(new ElaError(ElaRuntimeError.PrivateVariable, field)); return(Default()); } return(vm.modules[Handle][sc.Address]); } ctx.Fail(ElaRuntimeError.Unknown, "VM is non present"); return(Default()); }
internal bool HasField(ElaValue key, ExecutionContext ctx) { var idx = key.I4; if (key.TypeId != ElaMachine.STR) { ctx.InvalidType(TCF.GetShortForm(ElaTypeCode.String), key); return(false); } return(GetOrdinal(key.DirectGetString()) != -1); }
internal bool HasField(ElaValue index, ExecutionContext ctx) { if (vm != null) { if (index.TypeId != ElaMachine.STR) { ctx.InvalidType(TCF.GetShortForm(ElaTypeCode.String), index); return(false); } var frame = vm.Assembly.GetModule(Handle); return(frame.GlobalScope.Locals.ContainsKey(index.DirectGetString())); } ctx.Fail(ElaRuntimeError.Unknown, "VM is non present"); return(false); }
internal ElaValue GetField(ElaValue key, ExecutionContext ctx) { if (key.TypeId != ElaMachine.STR) { ctx.InvalidType(TCF.GetShortForm(ElaTypeCode.String), key); return(Default()); } var idx = GetOrdinal(key.DirectGetString()); if (idx == -1) { ctx.UnknownField(key.DirectGetString(), new ElaValue(this)); return(Default()); } return(values[idx]); }
private static Exception InvalidCast(ElaValue val, System.Type target) { return(new InvalidCastException(Strings.GetMessage("InvalidCast", TCF.GetShortForm(val.TypeCode), target.Name))); }
private static Exception InvalidCast(ElaValue val, ElaTypeCode type) { return(new ElaRuntimeException(ElaRuntimeError.InvalidType, TCF.GetShortForm(type), val.GetTypeName())); }
public TypeData(ElaTypeCode typeCode) : this((Int32)typeCode, TCF.GetShortForm(typeCode)) { }
protected internal virtual string GetTypeName() { return(TCF.GetShortForm((ElaTypeCode)TypeId)); }
public static TreeNode Literal(this TreeNode par, ElaExpression exp, ElaTypeCode typeCode, object data) { return(Element(par, exp, TCF.GetShortForm(typeCode), data, "Literal", "{1} ({0})")); }