JsValue.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Diagnostics.Contracts;
  5. using System.Dynamic;
  6. using System.Runtime.CompilerServices;
  7. using System.Threading;
  8. using Jint.Native.Array;
  9. using Jint.Native.Boolean;
  10. using Jint.Native.Date;
  11. using Jint.Native.Function;
  12. using Jint.Native.Number;
  13. using Jint.Native.Object;
  14. using Jint.Native.RegExp;
  15. using Jint.Native.String;
  16. using Jint.Runtime;
  17. using Jint.Runtime.Interop;
  18. namespace Jint.Native
  19. {
  20. [DebuggerTypeProxy(typeof(JsValueDebugView))]
  21. public class JsValue : IEquatable<JsValue>
  22. {
  23. // how many decimals to check when determining if double is actually an int
  24. private const double DoubleIsIntegerTolerance = double.Epsilon * 100;
  25. private static readonly long NegativeZeroBits = BitConverter.DoubleToInt64Bits(-0.0);
  26. // we can cache most common values, doubles are used in indexing too at times so we also cache
  27. // integer values converted to doubles
  28. private const int NumbersMax = 1024 * 10;
  29. private static readonly JsValue[] _doubleToJsValue = new JsValue[NumbersMax];
  30. private static readonly JsValue[] _intToJsValue = new JsValue[NumbersMax];
  31. private const int AsciiMax = 126;
  32. private static readonly JsValue[] _charToJsValue = new JsValue[AsciiMax + 1];
  33. private static readonly JsValue[] _charToStringJsValue = new JsValue[AsciiMax + 1];
  34. private static readonly JsValue EmptyString = new JsValue("");
  35. private static readonly JsValue NullString = new JsValue("null");
  36. public static readonly JsValue Undefined = new JsValue(Types.Undefined);
  37. public static readonly JsValue Null = new JsValue(Types.Null);
  38. public static readonly JsValue False = new JsValue(false);
  39. public static readonly JsValue True = new JsValue(true);
  40. private static readonly JsValue DoubleNaN = new JsValue(double.NaN);
  41. private static readonly JsValue DoubleNegativeOne = new JsValue((double) -1);
  42. private static readonly JsValue DoublePositiveInfinity= new JsValue(double.PositiveInfinity);
  43. private static readonly JsValue DoubleNegativeInfinity = new JsValue(double.NegativeInfinity);
  44. private static readonly JsValue IntegerNegativeOne = new JsValue(-1);
  45. private readonly double _double;
  46. private readonly object _object;
  47. protected Types _type;
  48. static JsValue()
  49. {
  50. for (int i = 0; i < NumbersMax; i++)
  51. {
  52. _intToJsValue[i] = new JsValue(i);
  53. _doubleToJsValue[i] = new JsValue((double) i);
  54. }
  55. for (int i = 0; i <= AsciiMax; i++)
  56. {
  57. _charToJsValue[i] = new JsValue((char) i);
  58. _charToStringJsValue[i] = new JsValue(((char) i).ToString());
  59. }
  60. }
  61. public JsValue(bool value)
  62. {
  63. _double = value ? 1.0 : 0.0;
  64. _object = null;
  65. _type = Types.Boolean;
  66. }
  67. public JsValue(double value)
  68. {
  69. _object = null;
  70. _type = Types.Number;
  71. _double = value;
  72. }
  73. public JsValue(int value)
  74. {
  75. _object = null;
  76. _type = Types.Number;
  77. _double = value;
  78. }
  79. public JsValue(uint value)
  80. {
  81. _object = null;
  82. _type = Types.Number;
  83. _double = value;
  84. }
  85. public JsValue(char value)
  86. {
  87. _double = double.NaN;
  88. _object = value;
  89. _type = Types.String;
  90. }
  91. public JsValue(string value)
  92. {
  93. _double = double.NaN;
  94. _object = value;
  95. _type = Types.String;
  96. }
  97. public JsValue(ObjectInstance value)
  98. {
  99. _double = double.NaN;
  100. _type = Types.Object;
  101. _object = value;
  102. }
  103. public JsValue(Completion value)
  104. {
  105. _double = double.NaN;
  106. _type = Types.Completion;
  107. _object = value;
  108. }
  109. private JsValue(Types type)
  110. {
  111. _double = double.NaN;
  112. _object = null;
  113. _type = type;
  114. }
  115. [Pure]
  116. public bool IsPrimitive()
  117. {
  118. return _type != Types.Object && _type != Types.None;
  119. }
  120. [Pure]
  121. public bool IsUndefined()
  122. {
  123. return _type == Types.Undefined;
  124. }
  125. [Pure]
  126. public bool IsArray()
  127. {
  128. return _type == Types.Object && _object is ArrayInstance;
  129. }
  130. [Pure]
  131. public bool IsDate()
  132. {
  133. return _type == Types.Object && _object is DateInstance;
  134. }
  135. [Pure]
  136. public bool IsRegExp()
  137. {
  138. return _type == Types.Object && _object is RegExpInstance;
  139. }
  140. [Pure]
  141. public bool IsObject()
  142. {
  143. return _type == Types.Object;
  144. }
  145. [Pure]
  146. public bool IsString()
  147. {
  148. return _type == Types.String;
  149. }
  150. [Pure]
  151. public bool IsNumber()
  152. {
  153. return _type == Types.Number;
  154. }
  155. [Pure]
  156. public bool IsBoolean()
  157. {
  158. return _type == Types.Boolean;
  159. }
  160. [Pure]
  161. public bool IsNull()
  162. {
  163. return _type == Types.Null;
  164. }
  165. [Pure]
  166. public bool IsCompletion()
  167. {
  168. return _type == Types.Completion;
  169. }
  170. [Pure]
  171. public bool IsSymbol()
  172. {
  173. return _type == Types.Symbol;
  174. }
  175. [Pure]
  176. public ObjectInstance AsObject()
  177. {
  178. if (_type != Types.Object)
  179. {
  180. throw new ArgumentException("The value is not an object");
  181. }
  182. return _object as ObjectInstance;
  183. }
  184. [Pure]
  185. public TInstance AsInstance<TInstance>() where TInstance : class
  186. {
  187. if (_type != Types.Object)
  188. {
  189. throw new ArgumentException("The value is not an object");
  190. }
  191. return _object as TInstance;
  192. }
  193. [Pure]
  194. public ArrayInstance AsArray()
  195. {
  196. if (!IsArray())
  197. {
  198. throw new ArgumentException("The value is not an array");
  199. }
  200. return _object as ArrayInstance;
  201. }
  202. [Pure]
  203. public DateInstance AsDate()
  204. {
  205. if (!IsDate())
  206. {
  207. throw new ArgumentException("The value is not a date");
  208. }
  209. return _object as DateInstance;
  210. }
  211. [Pure]
  212. public RegExpInstance AsRegExp()
  213. {
  214. if (!IsRegExp())
  215. {
  216. throw new ArgumentException("The value is not a date");
  217. }
  218. return _object as RegExpInstance;
  219. }
  220. [Pure]
  221. public Completion AsCompletion()
  222. {
  223. if (_type != Types.Completion)
  224. {
  225. throw new ArgumentException("The value is not a completion record");
  226. }
  227. return (Completion)_object;
  228. }
  229. [Pure]
  230. public T TryCast<T>(Action<JsValue> fail = null) where T : class
  231. {
  232. if (IsObject())
  233. {
  234. var o = AsObject();
  235. var t = o as T;
  236. if (t != null)
  237. {
  238. return t;
  239. }
  240. }
  241. fail?.Invoke(this);
  242. return null;
  243. }
  244. public bool Is<T>()
  245. {
  246. return _type == Types.Object && _object is T;
  247. }
  248. public T As<T>() where T : ObjectInstance
  249. {
  250. return _object as T;
  251. }
  252. [Pure]
  253. public bool AsBoolean()
  254. {
  255. if (_type != Types.Boolean)
  256. {
  257. throw new ArgumentException("The value is not a boolean");
  258. }
  259. return _double != 0;
  260. }
  261. [Pure]
  262. public string AsString()
  263. {
  264. if (_type != Types.String)
  265. {
  266. throw new ArgumentException("The value is not a string");
  267. }
  268. if (_object == null)
  269. {
  270. throw new ArgumentException("The value is not defined");
  271. }
  272. return (string)_object;
  273. }
  274. [Pure]
  275. public string AsSymbol()
  276. {
  277. if (_type != Types.Symbol)
  278. {
  279. throw new ArgumentException("The value is not a symbol");
  280. }
  281. if (_object == null)
  282. {
  283. throw new ArgumentException("The value is not defined");
  284. }
  285. return (string)_object;
  286. }
  287. [Pure]
  288. public double AsNumber()
  289. {
  290. if (_type != Types.Number)
  291. {
  292. throw new ArgumentException("The value is not a number");
  293. }
  294. return _double;
  295. }
  296. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  297. public bool Equals(JsValue other)
  298. {
  299. if (other == null)
  300. {
  301. return false;
  302. }
  303. if(ReferenceEquals(this, other))
  304. {
  305. return true;
  306. }
  307. if (_type != other._type)
  308. {
  309. return false;
  310. }
  311. switch (_type)
  312. {
  313. case Types.None:
  314. return false;
  315. case Types.Undefined:
  316. return true;
  317. case Types.Null:
  318. return true;
  319. case Types.Boolean:
  320. case Types.Number:
  321. return _double == other._double;
  322. case Types.String:
  323. case Types.Object:
  324. return _object == other._object;
  325. default:
  326. throw new ArgumentOutOfRangeException();
  327. }
  328. }
  329. public Types Type => _type;
  330. internal static JsValue FromDouble(double value)
  331. {
  332. // we can cache positive double zero, but not negative, -0 == 0 in C# but in JS it's a different story
  333. if ((value == 0 && BitConverter.DoubleToInt64Bits(value) != NegativeZeroBits || value >= 1)
  334. && value < _doubleToJsValue.Length
  335. && System.Math.Abs(value % 1) <= DoubleIsIntegerTolerance)
  336. {
  337. return _doubleToJsValue[(int) value];
  338. }
  339. if (value == -1)
  340. {
  341. return DoubleNegativeOne;
  342. }
  343. if (value == double.NegativeInfinity)
  344. {
  345. return DoubleNegativeInfinity;
  346. }
  347. if (value == double.PositiveInfinity)
  348. {
  349. return DoublePositiveInfinity;
  350. }
  351. if (double.IsNaN(value))
  352. {
  353. return DoubleNaN;
  354. }
  355. return new JsValue(value);
  356. }
  357. internal static JsValue FromInt(int value)
  358. {
  359. if (value >= 0 && value < _intToJsValue.Length)
  360. {
  361. return _intToJsValue[value];
  362. }
  363. if (value == -1)
  364. {
  365. return IntegerNegativeOne;
  366. }
  367. return new JsValue(value);
  368. }
  369. internal static JsValue FromInt(uint value)
  370. {
  371. if (value >= 0 && value < _intToJsValue.Length)
  372. {
  373. return _intToJsValue[value];
  374. }
  375. return new JsValue(value);
  376. }
  377. internal static JsValue FromInt(ulong value)
  378. {
  379. if (value >= 0 && value < (ulong) _intToJsValue.Length)
  380. {
  381. return _intToJsValue[value];
  382. }
  383. return new JsValue(value);
  384. }
  385. internal static JsValue FromChar(char value)
  386. {
  387. if (value >= 0 && value <= AsciiMax)
  388. {
  389. return _charToJsValue[value];
  390. }
  391. return new JsValue(value);
  392. }
  393. /// <summary>
  394. /// Creates a valid <see cref="JsValue"/> instance from any <see cref="Object"/> instance
  395. /// </summary>
  396. /// <param name="engine"></param>
  397. /// <param name="value"></param>
  398. /// <returns></returns>
  399. public static JsValue FromObject(Engine engine, object value)
  400. {
  401. if (value == null)
  402. {
  403. return Null;
  404. }
  405. foreach (var converter in engine.Options._ObjectConverters)
  406. {
  407. if (converter.TryConvert(value, out var result))
  408. {
  409. return result;
  410. }
  411. }
  412. var valueType = value.GetType();
  413. var typeMappers = Engine.TypeMappers;
  414. if (typeMappers.TryGetValue(valueType, out var typeMapper))
  415. {
  416. return typeMapper(engine, value);
  417. }
  418. // if an ObjectInstance is passed directly, use it as is
  419. if (value is ObjectInstance instance)
  420. {
  421. // Learn conversion.
  422. // Learn conversion, racy, worst case we'll try again later
  423. Interlocked.CompareExchange(ref Engine.TypeMappers, new Dictionary<Type, Func<Engine, object, JsValue>>(typeMappers)
  424. {
  425. [valueType] = (Engine e, object v) => ((ObjectInstance)v).JsValue
  426. }, typeMappers);
  427. return instance.JsValue;
  428. }
  429. var type = value as Type;
  430. if(type != null)
  431. {
  432. var typeReference = TypeReference.CreateTypeReference(engine, type);
  433. return typeReference.JsValue;
  434. }
  435. if (value is System.Array a)
  436. {
  437. JsValue Convert(Engine e, object v)
  438. {
  439. var array = (System.Array) v;
  440. var jsArray = engine.Array.Construct(a.Length);
  441. foreach (var item in array)
  442. {
  443. var jsItem = FromObject(engine, item);
  444. engine.Array.PrototypeObject.Push(jsArray, Arguments.From(jsItem));
  445. }
  446. return jsArray;
  447. }
  448. // racy, we don't care, worst case we'll catch up later
  449. Interlocked.CompareExchange(ref Engine.TypeMappers, new Dictionary<Type, Func<Engine, object, JsValue>>(typeMappers)
  450. {
  451. [valueType] = Convert
  452. }, typeMappers);
  453. return Convert(engine, a);
  454. }
  455. if (value is Delegate d)
  456. {
  457. return new DelegateWrapper(engine, d);
  458. }
  459. if (value.GetType().IsEnum())
  460. {
  461. return FromInt((int) value);
  462. }
  463. // if no known type could be guessed, wrap it as an ObjectInstance
  464. return new ObjectWrapper(engine, value);
  465. }
  466. /// <summary>
  467. /// Converts a <see cref="JsValue"/> to its underlying CLR value.
  468. /// </summary>
  469. /// <returns>The underlying CLR value of the <see cref="JsValue"/> instance.</returns>
  470. public object ToObject()
  471. {
  472. switch (_type)
  473. {
  474. case Types.None:
  475. case Types.Undefined:
  476. case Types.Null:
  477. return null;
  478. case Types.String:
  479. return _object;
  480. case Types.Boolean:
  481. return _double != 0;
  482. case Types.Number:
  483. return _double;
  484. case Types.Object:
  485. if (_object is IObjectWrapper wrapper)
  486. {
  487. return wrapper.Target;
  488. }
  489. switch ((_object as ObjectInstance).Class)
  490. {
  491. case "Array":
  492. if (_object is ArrayInstance arrayInstance)
  493. {
  494. var len = TypeConverter.ToInt32(arrayInstance.Get("length"));
  495. var result = new object[len];
  496. for (var k = 0; k < len; k++)
  497. {
  498. var pk = TypeConverter.ToString(k);
  499. var kpresent = arrayInstance.HasProperty(pk);
  500. if (kpresent)
  501. {
  502. var kvalue = arrayInstance.Get(pk);
  503. result[k] = kvalue.ToObject();
  504. }
  505. else
  506. {
  507. result[k] = null;
  508. }
  509. }
  510. return result;
  511. }
  512. break;
  513. case "String":
  514. if (_object is StringInstance stringInstance)
  515. {
  516. return stringInstance.PrimitiveValue.AsString();
  517. }
  518. break;
  519. case "Date":
  520. if (_object is DateInstance dateInstance)
  521. {
  522. return dateInstance.ToDateTime();
  523. }
  524. break;
  525. case "Boolean":
  526. if (_object is BooleanInstance booleanInstance)
  527. {
  528. return booleanInstance.PrimitiveValue.AsBoolean();
  529. }
  530. break;
  531. case "Function":
  532. if (_object is FunctionInstance function)
  533. {
  534. return (Func<JsValue, JsValue[], JsValue>)function.Call;
  535. }
  536. break;
  537. case "Number":
  538. if (_object is NumberInstance numberInstance)
  539. {
  540. return numberInstance.NumberData.AsNumber();
  541. }
  542. break;
  543. case "RegExp":
  544. if (_object is RegExpInstance regeExpInstance)
  545. {
  546. return regeExpInstance.Value;
  547. }
  548. break;
  549. case "Arguments":
  550. case "Object":
  551. #if __IOS__
  552. IDictionary<string, object> o = new Dictionary<string, object>();
  553. #else
  554. IDictionary<string, object> o = new ExpandoObject();
  555. #endif
  556. var objectInstance = (ObjectInstance) _object;
  557. foreach (var p in objectInstance.GetOwnProperties())
  558. {
  559. if (!p.Value.Enumerable.HasValue || p.Value.Enumerable.Value == false)
  560. {
  561. continue;
  562. }
  563. o.Add(p.Key, objectInstance.Get(p.Key).ToObject());
  564. }
  565. return o;
  566. }
  567. return _object;
  568. default:
  569. throw new ArgumentOutOfRangeException();
  570. }
  571. }
  572. /// <summary>
  573. /// Invoke the current value as function.
  574. /// </summary>
  575. /// <param name="arguments">The arguments of the function call.</param>
  576. /// <returns>The value returned by the function call.</returns>
  577. public JsValue Invoke(params JsValue[] arguments)
  578. {
  579. return Invoke(Undefined, arguments);
  580. }
  581. /// <summary>
  582. /// Invoke the current value as function.
  583. /// </summary>
  584. /// <param name="thisObj">The this value inside the function call.</param>
  585. /// <param name="arguments">The arguments of the function call.</param>
  586. /// <returns>The value returned by the function call.</returns>
  587. public JsValue Invoke(JsValue thisObj, JsValue[] arguments)
  588. {
  589. var callable = TryCast<ICallable>();
  590. if (callable == null)
  591. {
  592. throw new ArgumentException("Can only invoke functions");
  593. }
  594. return callable.Call(thisObj, arguments);
  595. }
  596. public static bool ReturnOnAbruptCompletion(ref JsValue argument)
  597. {
  598. if (!argument.IsCompletion())
  599. {
  600. return false;
  601. }
  602. var completion = argument.AsCompletion();
  603. if (completion.IsAbrupt())
  604. {
  605. return true;
  606. }
  607. argument = completion.Value;
  608. return false;
  609. }
  610. public override string ToString()
  611. {
  612. switch (Type)
  613. {
  614. case Types.None:
  615. return "None";
  616. case Types.Undefined:
  617. return "undefined";
  618. case Types.Null:
  619. return "null";
  620. case Types.Boolean:
  621. return _double != 0 ? bool.TrueString : bool.FalseString;
  622. case Types.Number:
  623. return _double.ToString();
  624. case Types.String:
  625. case Types.Object:
  626. return _object.ToString();
  627. default:
  628. return string.Empty;
  629. }
  630. }
  631. public static bool operator ==(JsValue a, JsValue b)
  632. {
  633. if ((object) a == null)
  634. {
  635. if ((object) b == null)
  636. {
  637. return true;
  638. }
  639. return false;
  640. }
  641. if ((object) b == null)
  642. {
  643. return false;
  644. }
  645. return a.Equals(b);
  646. }
  647. public static bool operator !=(JsValue a, JsValue b)
  648. {
  649. if ((object) a == null)
  650. {
  651. if ((object) b == null)
  652. {
  653. return false;
  654. }
  655. return true;
  656. }
  657. if ((object) b == null)
  658. {
  659. return true;
  660. }
  661. return !a.Equals(b);
  662. }
  663. static public implicit operator JsValue(char value)
  664. {
  665. return FromChar(value);
  666. }
  667. static public implicit operator JsValue(int value)
  668. {
  669. return FromInt(value);
  670. }
  671. static public implicit operator JsValue(uint value)
  672. {
  673. return FromInt(value);
  674. }
  675. static public implicit operator JsValue(double value)
  676. {
  677. return FromDouble(value);
  678. }
  679. public static implicit operator JsValue(bool value)
  680. {
  681. return value ? True : False;
  682. }
  683. public static implicit operator JsValue(string value)
  684. {
  685. if (value.Length <= 1)
  686. {
  687. if (value == "")
  688. {
  689. return EmptyString;
  690. }
  691. if (value.Length == 1)
  692. {
  693. if (value[0] >= 0 && value[0] <= AsciiMax)
  694. {
  695. return _charToStringJsValue[value[0]];
  696. }
  697. }
  698. }
  699. else if (value == Native.Null.Text)
  700. {
  701. return NullString;
  702. }
  703. return new JsValue(value);
  704. }
  705. public static implicit operator JsValue(ObjectInstance value)
  706. {
  707. return value.JsValue;
  708. }
  709. internal class JsValueDebugView
  710. {
  711. public string Value;
  712. public JsValueDebugView(JsValue value)
  713. {
  714. switch (value.Type)
  715. {
  716. case Types.None:
  717. Value = "None";
  718. break;
  719. case Types.Undefined:
  720. Value = "undefined";
  721. break;
  722. case Types.Null:
  723. Value = "null";
  724. break;
  725. case Types.Boolean:
  726. Value = value.AsBoolean() + " (bool)";
  727. break;
  728. case Types.String:
  729. Value = value.AsString() + " (string)";
  730. break;
  731. case Types.Number:
  732. Value = value.AsNumber() + " (number)";
  733. break;
  734. case Types.Object:
  735. Value = value.AsObject().GetType().Name;
  736. break;
  737. case Types.Symbol:
  738. Value = value.AsSymbol() + " (symbol)";
  739. break;
  740. default:
  741. Value = "Unknown";
  742. break;
  743. }
  744. }
  745. }
  746. public override bool Equals(object obj)
  747. {
  748. if (ReferenceEquals(null, obj)) return false;
  749. return obj is JsValue value && Equals(value);
  750. }
  751. public override int GetHashCode()
  752. {
  753. unchecked
  754. {
  755. var hashCode = 0;
  756. hashCode = (hashCode * 397) ^ _double.GetHashCode();
  757. hashCode = (hashCode * 397) ^ (_object != null ? _object.GetHashCode() : 0);
  758. hashCode = (hashCode * 397) ^ (int)_type;
  759. return hashCode;
  760. }
  761. }
  762. }
  763. /// <summary>
  764. /// The _object value of a <see cref="JsSymbol"/> is the [[Description]] internal slot.
  765. /// </summary>
  766. public class JsSymbol : JsValue
  767. {
  768. public JsSymbol(string description) : base(description)
  769. {
  770. _type = Types.Symbol;
  771. }
  772. }
  773. }