internal void Add(JsSymbol symbol) { if (_customSymbolLookup == null) { _customSymbolLookup = new Dictionary <JsValue, JsSymbol>(); } _customSymbolLookup[symbol._value] = symbol; }
protected void SetIntrinsicValue(JsSymbol symbol, JsValue value, bool writable, bool enumerable, bool configurable) { if (_intrinsicProperties == null) { _intrinsicProperties = new Dictionary <string, PropertyDescriptor>(); } _intrinsicProperties[symbol.AsSymbol()] = new PropertyDescriptor(value, writable, enumerable, configurable); }
public SymbolInstance Construct(JsSymbol symbol) { var instance = new SymbolInstance(Engine) { _prototype = PrototypeObject, SymbolData = symbol }; return(instance); }
public SymbolInstance Construct(JsSymbol symbol) { var instance = new SymbolInstance(Engine) { Prototype = PrototypeObject, SymbolData = symbol, Extensible = true }; return(instance); }
public JsValue For(JsValue thisObj, JsValue[] arguments) { var stringKey = TypeConverter.ToString(arguments.At(0)); // 2. ReturnIfAbrupt(stringKey). JsSymbol symbol; if (!Engine.GlobalSymbolRegistry.TryGetValue(stringKey, out symbol)) { symbol = new JsSymbol(stringKey); Engine.GlobalSymbolRegistry.Add(stringKey, symbol); } return(symbol); }
/// <summary> /// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-symbol-description /// </summary> public override JsValue Call(JsValue thisObject, JsValue[] arguments) { var description = arguments.At(0); var descString = description.IsUndefined() ? Undefined : TypeConverter.ToString(description); if (ReturnOnAbruptCompletion(ref descString)) { return(descString); } var value = new JsSymbol(TypeConverter.ToString(description)); return(value); }
protected bool TryGetIntrinsicValue(JsSymbol symbol, out JsValue value) { PropertyDescriptor descriptor; if (_intrinsicProperties != null && _intrinsicProperties.TryGetValue(symbol.AsSymbol(), out descriptor)) { value = descriptor.Value; return(true); } if (ReferenceEquals(Prototype, null)) { value = Undefined; return(false); } return(Prototype.TryGetIntrinsicValue(symbol, out value)); }
internal bool TryGetSymbol(JsValue key, out JsSymbol symbol) { symbol = null; return(_customSymbolLookup != null && _customSymbolLookup.TryGetValue(key, out symbol)); }
public SymbolInstance Construct(JsSymbol symbol) { return(new SymbolInstance(Engine, PrototypeObject, symbol)); }
private static string SymbolDescriptiveString(JsSymbol symbol) => symbol.ToString();
public string SymbolDescriptiveString(JsSymbol sym) { return($"Symbol({sym.AsSymbol()})"); }
internal SymbolInstance(Engine engine, SymbolPrototype prototype, JsSymbol symbol) : base(engine, ObjectClass.Symbol) { _prototype = prototype; SymbolData = symbol; }
internal void Add(JsSymbol symbol) { _customSymbolLookup ??= new Dictionary <JsValue, JsSymbol>(); _customSymbolLookup[symbol._value] = symbol; }