示例#1
0
        public override bool Equals(object other)
        {
            var dtOther = other as DataType;

            if (dtOther == null)
            {
                return(false);
            }
            if (typeStack.Contains(this, dtOther))
            {
                return(true);
            }
            else if (other is DictType)
            {
                typeStack.Push(this, dtOther);
                DictType co  = (DictType)other;
                bool     ret = (co.KeyType.Equals(KeyType) &&
                                co.ValueType.Equals(ValueType));
                typeStack.Pop(this, other);
                return(ret);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
 public string VisitDict(DictType d)
 {
     //        StringBuilder sb = new StringBuilder();
     //
     //        Integer num = ctr.visit(this);
     //        if (num != null) {
     //            sb.Append("#").append(num);
     //        } else {
     //            ctr.push(this);
     //            sb.Append("{");
     //            sb.Append(keyType.printType(ctr));
     //            sb.Append(" : ");
     //            sb.Append(valueType.printType(ctr));
     //            sb.Append("}");
     //            ctr.pop(this);
     //        }
     //
     //        return sb.toString();
     return("dict");
 }
示例#3
0
 private DictType Register(DictType dictType)
 {
     dictType.Table.addSuper(analyzer.Builtins.BaseDict.Table);
     dictType.Table.Path = analyzer.Builtins.BaseDict.Table.Path;
     return(dictType);
 }