예제 #1
0
 /// <exception cref="NotSupportedException">Always thrown.</exception>
 public void Grow(int end, int beginning, ZilObject defaultValue)
 {
     throw new NotSupportedException();
 }
예제 #2
0
 public ZilAdecl([NotNull] ZilObject first, [NotNull] ZilObject second)
 {
     First  = first ?? throw new ArgumentNullException(nameof(first));
     Second = second ?? throw new ArgumentNullException(nameof(second));
 }
예제 #3
0
 /// <summary>
 /// Determines whether another <see cref="ZilObject"/> is "the same object" as the current one,
 /// for the purposes of <c>==?</c> and <c>N==?</c> comparisons.
 /// </summary>
 /// <param name="other">The other object.</param>
 /// <returns><see langword="true"/> if the objects are identical; otherwise <see langword="false"/>.</returns>
 /// <remarks>
 /// MDL defines <c>==?</c> as being true iff the objects are made up of the same bits in
 /// MDL's internal representation. For non-structured types, this means they have the same <c>TYPE</c> and value.
 /// For structured types, it means they reference the same location in the same structure; for values of
 /// <c>PRIMTYPE</c> <c>LIST</c>, they may also both be empty.
 /// </remarks>
 /// <seealso cref="StructurallyEquals"/>
 public virtual bool ExactlyEquals(ZilObject other)
 {
     return(ReferenceEquals(this, other));
 }
예제 #4
0
 /// <summary>
 /// Determines whether another <see cref="ZilObject"/> is "structurally equal" or "looks the same"
 /// as the current one, for the purposes of <c>=?</c> and <c>N=?</c> comparisons.
 /// </summary>
 /// <param name="other">The other object.</param>
 /// <returns><see langword="true"/> if the objects are structurally equal; otherwise <see langword="false"/>.</returns>
 /// <remarks>
 /// MDL defines <c>=?</c> as being true for non-structured objects iff they are "the same object" (<c>==?</c>);
 /// and for structured objects if they have the same <c>TYPE</c>, same length, and each element in one is
 /// <c>=?</c> to the corresponding element in the other.
 /// </remarks>
 /// <seealso cref="ExactlyEquals"/>
 public virtual bool StructurallyEquals([CanBeNull] ZilObject other)
 {
     return(Equals(other));
 }
예제 #5
0
 public void Grow(int end, int beginning, ZilObject defaultValue)
 {
     storage.Grow(end, beginning, defaultValue);
 }
예제 #6
0
 public bool IsCons([CanBeNull] out ZilObject first, [CanBeNull] out ZilListoidBase rest)
 {
     (first, rest) = (this.First, this.Rest);
     Debug.Assert(first == null && rest == null || first != null && rest != null);
     return(first != null);
 }
예제 #7
0
 static ZilObject MakeSpliceExpandable(ZilObject zo)
 {
     (zo as ZilSplice)?.SetSpliceableFlag();
     return(zo);
 }
예제 #8
0
 public ZilForm(ZilObject first, ZilListoidBase rest)
     : base(first, rest)
 {
 }
예제 #9
0
 public override bool StructurallyEquals(ZilObject obj)
 {
     return(obj is ZilEvalMacro other && other.WrappedValue.StructurallyEquals(WrappedValue));
 }
예제 #10
0
 public ZilEvalMacro(ZilObject value)
 {
     WrappedValue = value;
 }
예제 #11
0
 public override bool ExactlyEquals(ZilObject obj)
 {
     return(obj is ZilChar other && other.value == value);
 }
예제 #12
0
 public sealed override bool StructurallyEquals(ZilObject other)
 {
     return(other is ZilHashBase <TPrim> hash && hash.type == type &&
            ((ZilObject)(object)hash.primValue).StructurallyEquals((ZilObject)(object)primValue));
 }
예제 #13
0
 public override bool ExactlyEquals(ZilObject obj)
 {
     return((obj as ZilString)?.Text.Equals(Text) ?? false);
 }
예제 #14
0
 public void Deconstruct([NotNull] out ZilObject first, [NotNull] out ZilObject second)
 {
     first  = this.First;
     second = this.Second;
 }
예제 #15
0
 public override bool StructurallyEquals(ZilObject obj)
 {
     return(obj is ZilVector other && this.SequenceStructurallyEqual(other));
 }
예제 #16
0
 public override bool StructurallyEquals(ZilObject obj)
 {
     return(obj is ZilAdecl other && other.First.StructurallyEquals(First) && other.Second.StructurallyEquals(Second));
 }
예제 #17
0
 public ZilMacroResult([NotNull] ZilObject inner)
 {
     this.Inner = inner;
 }