123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using Jint.Native;
- using Jint.Native.Boolean;
- using Jint.Native.Errors;
- using Jint.Native.Number;
- using Jint.Native.Object;
- using Jint.Native.String;
- using Jint.Runtime.Environments;
- namespace Jint.Runtime.References
- {
- /// <summary>
- /// Represents the Reference Specification Type
- /// http://www.ecma-international.org/ecma-262/5.1/#sec-8.7
- /// </summary>
- public class Reference
- {
- private readonly object _baseValue;
- private readonly string _name;
- private readonly bool _strict;
- private readonly EnvironmentRecord _record;
- public Reference(object baseValue, string name, bool strict)
- {
- _baseValue = baseValue;
- _name = name;
- _strict = strict;
- _record = baseValue as EnvironmentRecord;
- }
- public object GetBase()
- {
- return _baseValue;
- }
- public string GetReferencedName()
- {
- return _name;
- }
- public bool IsStrict()
- {
- return _strict;
- }
- public bool HasPrimitiveBase()
- {
- return (_baseValue is BooleanInstance)
- || (_baseValue is StringInstance)
- || (_baseValue is NumberInstance)
- ;
- }
- public bool IsUnresolvableReference()
- {
- return _baseValue == Undefined.Instance || _baseValue == Null.Instance;
- }
- public bool IsPropertyReference()
- {
- // http://www.ecma-international.org/ecma-262/5.1/#sec-8.7
- return _baseValue is ObjectInstance || HasPrimitiveBase();
- }
- }
- }
|