コード例 #1
0
ファイル: VariabelStorage.cs プロジェクト: river0825/Eir
        public bool Equals(ImmutableVariableStorage other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            var dictionaryComparer = new ImmutableDictionaryComparer <string, Variable>();

            return(dictionaryComparer.Equals(SuperGlobals, other.SuperGlobals) &&
                   dictionaryComparer.Equals(Globals, other.Globals) &&
                   dictionaryComparer.Equals(Locals, other.Locals) &&
                   dictionaryComparer.Equals(ClassVariables, other.ClassVariables) &&
                   dictionaryComparer.Equals(LocalAccessibleGlobals, other.LocalAccessibleGlobals));

            return(SuperGlobals.OrderBy(x => x.Key).SequenceEqual(other.SuperGlobals.OrderBy(x => x.Key)) &&
                   Globals.OrderBy(x => x.Key).SequenceEqual(other.Globals.OrderBy(x => x.Key)) &&
                   Locals.OrderBy(x => x.Key).SequenceEqual(other.Locals.OrderBy(x => x.Key)) &&
                   ClassVariables.OrderBy(x => x.Key).SequenceEqual(other.ClassVariables.OrderBy(x => x.Key)) &&
                   LocalAccessibleGlobals.OrderBy(x => x.Key).SequenceEqual(other.LocalAccessibleGlobals.OrderBy(x => x.Key)));

            return(SuperGlobals.SequenceEqual(other.SuperGlobals) &&
                   Globals.SequenceEqual(other.Globals) &&
                   Locals.SequenceEqual(other.Locals) &&
                   ClassVariables.SequenceEqual(other.ClassVariables) &&
                   LocalAccessibleGlobals.SequenceEqual(other.LocalAccessibleGlobals));
        }