Exemplo n.º 1
0
 public ObjectInstance(Engine engine, ObjectClass objectClass, InternalTypes type = InternalTypes.Object)
     : base(type)
 {
     _engine    = engine;
     _class     = objectClass;
     Extensible = true;
 }
Exemplo n.º 2
0
        /// <summary>
        /// http://www.ecma-international.org/ecma-262/6.0/#sec-topropertykey
        /// </summary>

        public static JsValue ToPropertyKey(JsValue o)
        {
            const InternalTypes stringOrSymbol = InternalTypes.String | InternalTypes.Symbol;

            return((o._type & stringOrSymbol) != 0
                ? o
                : ToPropertyKeyNonString(o));
        }
Exemplo n.º 3
0
 internal ObjectInstance(Engine engine, ObjectClass objectClass, InternalTypes type = InternalTypes.Object)
     : base(type)
 {
     _engine = engine;
     _class  = objectClass;
     // if engine is ready, we can take default prototype for object
     _prototype = engine.Realm.Intrinsics?.Object?.PrototypeObject;
     Extensible = true;
 }
Exemplo n.º 4
0
        private static JsValue ToPropertyKeyNonString(JsValue o)
        {
            const InternalTypes stringOrSymbol = InternalTypes.String | InternalTypes.Symbol;
            var primitive = ToPrimitive(o, Types.String);

            return((primitive._type & stringOrSymbol) != 0
                ? primitive
                : ToStringNonString(primitive));
        }
Exemplo n.º 5
0
        private static bool EqualUnlikely(JsValue x, JsValue y)
        {
            if (x._type == InternalTypes.Null && y._type == InternalTypes.Undefined)
            {
                return(true);
            }

            if (x._type == InternalTypes.Undefined && y._type == InternalTypes.Null)
            {
                return(true);
            }

            if (x.IsNumber() && y.IsString())
            {
                return(Equal(x, TypeConverter.ToNumber(y)));
            }

            if (x.IsString() && y.IsNumber())
            {
                return(Equal(TypeConverter.ToNumber(x), y));
            }

            if (x.IsBoolean())
            {
                return(Equal(TypeConverter.ToNumber(x), y));
            }

            if (y.IsBoolean())
            {
                return(Equal(x, TypeConverter.ToNumber(y)));
            }

            const InternalTypes stringOrNumber = InternalTypes.String | InternalTypes.Integer | InternalTypes.Number;

            if (y.IsObject() && (x._type & stringOrNumber) != 0)
            {
                return(Equal(x, TypeConverter.ToPrimitive(y)));
            }

            if (x.IsObject() && ((y._type & stringOrNumber) != 0))
            {
                return(Equal(TypeConverter.ToPrimitive(x), y));
            }

            return(false);
        }
Exemplo n.º 6
0
        public virtual SyntaxNode ToSyntaxNode(SyntaxGenerator syntaxGenerator)
        {
            var methodsSyntaxNodes       = Methods.Select(method => method.ToSyntaxNode(syntaxGenerator));
            var internalTypesSyntaxNodes = InternalTypes.Select(internalType => internalType.ToSyntaxNode(syntaxGenerator));

            var declarationModifiers = DeclarationModifiers.None.WithPartial(IsPartial);

            var typeSyntaxNode = syntaxGenerator.ClassDeclaration(Name,
                                                                  accessibility: Accessibility,
                                                                  modifiers: declarationModifiers,
                                                                  members: methodsSyntaxNodes.Union(internalTypesSyntaxNodes));

            foreach (var baseType in BaseTypes)
            {
                var baseTypeSyntaxNode = baseType.ToSyntaxNode(syntaxGenerator);
                typeSyntaxNode = syntaxGenerator.AddBaseType(typeSyntaxNode, baseTypeSyntaxNode);
            }

            syntaxGenerator.AddMembers(typeSyntaxNode, Methods.Select(method => method.ToSyntaxNode(syntaxGenerator)));

            return(typeSyntaxNode);
        }
Exemplo n.º 7
0
 public virtual void VisitSimulation(InternalTypes.Simulation n)
 {
 }
Exemplo n.º 8
0
 public virtual void VisitSettings(InternalTypes.Settings n)
 {
 }
Exemplo n.º 9
0
 public virtual void VisitSecurities(InternalTypes.Securities n)
 {
 }
Exemplo n.º 10
0
 public virtual void VisitPrincipalRules(InternalTypes.PrincipalRules n)
 {
 }
Exemplo n.º 11
0
 public virtual void VisitDeal(InternalTypes.Deal n)
 {
 }
Exemplo n.º 12
0
 public virtual void VisitCollateralItem(InternalTypes.CollateralItem n)
 {
 }
Exemplo n.º 13
0
 internal JsValue(InternalTypes type)
 {
     _type = type;
 }
Exemplo n.º 14
0
 protected JsValue(Types type)
 {
     _type = (InternalTypes)type;
 }
Exemplo n.º 15
0
 public virtual void VisitBond(InternalTypes.Bond n)
 {
 }
Exemplo n.º 16
0
 public virtual void VisitCollateral(InternalTypes.Collateral n)
 {
 }
Exemplo n.º 17
0
 public virtual void VisitInterestRules(InternalTypes.InterestRules n)
 {
 }
Exemplo n.º 18
0
 public virtual void VisitCreditPaymentRules(InternalTypes.CreditPaymentRules n)
 {
 }
Exemplo n.º 19
0
 public virtual void VisitInternalRuleListAnd(InternalTypes.InternalRuleListAnd n)
 {
 }
Exemplo n.º 20
0
 private JsString(string value, InternalTypes type) : base(type)
 {
     _value = value;
 }
Exemplo n.º 21
0
 public virtual void VisitInternalRuleListOr(InternalTypes.InternalRuleListOr n)
 {
 }