public ObjectInstance(Engine engine, ObjectClass objectClass, InternalTypes type = InternalTypes.Object) : base(type) { _engine = engine; _class = objectClass; Extensible = true; }
/// <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)); }
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; }
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)); }
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); }
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); }
public virtual void VisitSimulation(InternalTypes.Simulation n) { }
public virtual void VisitSettings(InternalTypes.Settings n) { }
public virtual void VisitSecurities(InternalTypes.Securities n) { }
public virtual void VisitPrincipalRules(InternalTypes.PrincipalRules n) { }
public virtual void VisitDeal(InternalTypes.Deal n) { }
public virtual void VisitCollateralItem(InternalTypes.CollateralItem n) { }
internal JsValue(InternalTypes type) { _type = type; }
protected JsValue(Types type) { _type = (InternalTypes)type; }
public virtual void VisitBond(InternalTypes.Bond n) { }
public virtual void VisitCollateral(InternalTypes.Collateral n) { }
public virtual void VisitInterestRules(InternalTypes.InterestRules n) { }
public virtual void VisitCreditPaymentRules(InternalTypes.CreditPaymentRules n) { }
public virtual void VisitInternalRuleListAnd(InternalTypes.InternalRuleListAnd n) { }
private JsString(string value, InternalTypes type) : base(type) { _value = value; }
public virtual void VisitInternalRuleListOr(InternalTypes.InternalRuleListOr n) { }