public JSInternalError(VirtualMachine vm, string message, string stackTrace, JSObject inherited) : base(vm, message, inherited) { Contract.Requires(!string.IsNullOrEmpty(stackTrace)); Contract.Requires(inherited == vm.InternalError); OwnMembers.Add("stackTrace", stackTrace); }
public JSError(VirtualMachine vm, string message, JSObject inherited) : base(vm, inherited) { Contract.Requires(inherited != null); OwnMembers.Add("name", "Error"); OwnMembers.Add("message", message); }
public virtual JSObject GetPrototype() { JSValue result; if (!OwnMembers.TryGetValue(PrototypeMemberName, out result)) { result = VM.NewObject(); OwnMembers.Add(PrototypeMemberName, result); } return(result.RequireObject()); }
public override JSValue GetMember(JSValue member) { var name = member.CastToString(); var result = base.GetMember(name); if (result == null) { Func <VirtualMachine, JSObject, JSValue> factory; if (_lazyMemberFactories.TryGetValue(name, out factory)) { result = factory(VM, this); OwnMembers.Add(name, result); } } return(result ?? Undefined); }
public bool IsPropertyValueValid(string propertyName, ref string errorMessageTemplate, ContextIdentifiers contextIdentifiers, string ruleId) { if (propertyName == "OwnMembers" && contextIdentifiers == ContextIdentifier.Save) { var persistentReferenceMemberInfos = OwnMembers.OfType <PersistentReferenceMemberInfo>().Where(info => info.TypeAttributes.OfType <PersistentAssociationAttribute>().Any()); foreach (var persistentReferenceMemberInfo in persistentReferenceMemberInfos) { var associationAttribute = persistentReferenceMemberInfo.TypeAttributes.OfType <PersistentAssociationAttribute>().FirstOrDefault(); if (associationAttribute != null) { var persistentCollectionMemberInfos = persistentReferenceMemberInfo.Owner.OwnMembers.OfType <PersistentCollectionMemberInfo>(); if (!persistentCollectionMemberInfos.Any(info => info.TypeAttributes.OfType <PersistentAssociationAttribute>() .Any(attribute => attribute.AssociationName == associationAttribute.AssociationName))) { return(false); } } } } return(true); }