Example #1
0
        public static string ShaderTypeString(this StructTypes typeEnum)
        {
            switch (typeEnum)
            {
            case StructTypes.Float:
                return("float");

            case StructTypes.Float2:
                return("float2");

            case StructTypes.Float3:
                return("float3");

            case StructTypes.Float4:
                return("float4");

            default:
                throw new Exception("Unsupported Type");
            }
        }
Example #2
0
 public CDebugStructuralType(IDebugClassField classField, IDebugContext context, StructTypes sType) 
   : base(classField as IDebugContainerField, context){
   this.m_ClassField = classField;
   this.m_StructType = sType;
 }
Example #3
0
        public DebugFieldNode(DebugEnvironment envr, IDebugSymbol symbol, Identifier name, IDebugValue container, TypeNode declaringType, int id)
        {
            this.debugEnv      = envr;
            this.Symbol        = symbol;
            this.Container     = container;
            this.Name          = name;
            this.index         = id;
            this.DeclaringType = declaringType;
            switch (symbol.Type.Kind)
            {
            case TypeKind.Class:
                this.Type = new DebugClassNode(this.debugEnv, this.Symbol.Type, ((IDebugFieldSymbol )symbol).GetValue(Container));
                break;

            case TypeKind.Stream:
                this.Type = symbol.Type.CompilerType;
                break;

            case TypeKind.Tuple:
                StructTypes sType = ((IDebugStructuralType)this.Symbol.Type).StructuralType;
                switch (sType)
                {
                case StructTypes.Tuple:
                    FieldList   list    = new FieldList();
                    IEnumSymbol symbols = ((IDebugStructuralType)this.Symbol.Type).GetMembers(null, true, SymbolKind.Field, SymbolModifiers.All);
                    if (symbols != null)
                    {
                        while (symbols.Current != null)
                        {
                            Field           fieldMember = new DebugFieldNode(this.debugEnv, symbols.Current, new Identifier(symbols.Current.Name), ((IDebugFieldSymbol )symbol).GetValue(Container), null, 0);
                            SymbolModifiers modifier    = symbols.Current.Modifiers;
                            if ((modifier & SymbolModifiers.Abstract) != 0)
                            {
                                fieldMember.Flags |= FieldFlags.None;
                            }
                            if ((modifier & SymbolModifiers.Final) != 0)
                            {
                                fieldMember.Flags |= FieldFlags.None;
                            }
                            if ((modifier & SymbolModifiers.Private) != 0)
                            {
                                fieldMember.Flags |= FieldFlags.Private;
                            }
                            if ((modifier & SymbolModifiers.Public) != 0)
                            {
                                fieldMember.Flags |= FieldFlags.Public;
                            }
                            if ((modifier & SymbolModifiers.Static) != 0)
                            {
                                fieldMember.Flags |= FieldFlags.Static;
                            }
                            list.Add(fieldMember);
                            symbols.MoveNext();
                        }
                    }
                    Class dummy = new Class();
                    dummy.DeclaringModule = new Module();
                    this.Type             = TupleType.For(list, dummy);
                    break;

                case StructTypes.Union:
                    // HACK: Need a better way for identifying return types
                    this.Type = TypeUnion.For(SymbolHelper.GetTypeList(this.Symbol.Type.FullName, this.debugEnv.context), new Module());
                    break;

                case StructTypes.Intersection:
                    // TODO: Need to figure out Intersection Types, I think depends on figuring out return Type
                    //this.Type = TypeIntersection.For(typeList, new Module());
                    this.Type = new Class();
                    break;
                }

                /*FieldList list = new FieldList();
                 * IEnumSymbol symbols = ((IDebugStructuralType) this.Symbol.Type).GetMembers(null, true, SymbolKind.Field, SymbolModifiers.All);
                 * if (symbols != null){
                 * while(symbols.Current != null){
                 *  list.Add(new DebugFieldNode(this.debugEnv, symbols.Current, new Identifier(symbols.Current.Name), null, null, 0));
                 *  symbols.MoveNext();
                 * }
                 * }
                 * Class dummy = new Class();
                 * dummy.DeclaringModule = new Module();
                 * this.Type = TupleType.For(list, dummy);*/
                break;

            case TypeKind.Primitive:
                switch (this.Symbol.Type.TypeCode)
                {
                case TypeCode.Boolean:
                    this.Type = SystemTypes.Boolean;
                    break;

                case TypeCode.Char:
                    this.Type = SystemTypes.Char;
                    break;

                case TypeCode.Int16:
                    this.Type = SystemTypes.Int16;
                    break;

                case TypeCode.UInt16:
                    this.Type = SystemTypes.UInt32;
                    break;

                case TypeCode.Int32:
                    this.Type = SystemTypes.Int32;
                    break;

                case TypeCode.UInt32:
                    this.Type = SystemTypes.UInt32;
                    break;

                case TypeCode.Int64:
                    this.Type = SystemTypes.Int64;
                    break;

                case TypeCode.UInt64:
                    this.Type = SystemTypes.UInt64;
                    break;

                case TypeCode.Double:
                    this.Type = SystemTypes.Double;
                    break;

                case TypeCode.Single:
                    this.Type = SystemTypes.Single;
                    break;

                case TypeCode.SByte:
                    this.Type = SystemTypes.Int8;
                    break;

                case TypeCode.Byte:
                    this.Type = SystemTypes.UInt8;
                    break;

                case TypeCode.String:
                    this.Type = SystemTypes.String;
                    break;
                }
                break;

            case TypeKind.Enum:
                this.Type = new DebugEnumNode(this.debugEnv, this.Symbol.Type);
                break;
            }
        }