MakeUnion() public static method

public static MakeUnion ( ISet bs ) : DataType
bs ISet
return DataType
Beispiel #1
0
        public DataType GetAttrType(AttributeAccess a, DataType targetType)
        {
            ISet <Binding> bs = targetType.Table.LookupAttribute(a.FieldName.Name);

            if (bs == null)
            {
                analyzer.putProblem(a.FieldName, "attribute not found in type: " + targetType);
                DataType t = DataType.Unknown;
                t.Table.Path = targetType.Table.ExtendPath(analyzer, a.FieldName.Name);
                return(t);
            }
            else
            {
                analyzer.addRef(a, targetType, bs);
                return(State.MakeUnion(bs));
            }
        }
Beispiel #2
0
        public DataType VisitIdentifier(Identifier id)
        {
            ISet <Binding> b = scope.Lookup(id.Name);

            if (b != null)
            {
                analyzer.putRef(id, b);
                analyzer.Resolved.Add(id);
                analyzer.unresolved.Remove(id);
                return(State.MakeUnion(b));
            }
            else if (id.Name == "True" || id.Name == "False")
            {
                return(DataType.Bool);
            }
            else
            {
                analyzer.putProblem(id, "unbound variable " + id.Name);
                analyzer.unresolved.Add(id);
                DataType t = DataType.Unknown;
                t.Table.Path = scope.extendPath(analyzer, id.Name);
                return(t);
            }
        }