Пример #1
0
        /// <summary>
        /// Creates a new type reference.
        ///
        /// <param name="symbol">unresolved type symbol</param>
        /// <param name="source">reference to source code</param>
        /// <returns>newly created type reference</returns>
        /// </summary>
        public static UnresolvedType from_symbol(UnresolvedSymbol symbol, SourceReference source = null)
        {
            UnresolvedType @this = new UnresolvedType();

            @this.unresolved_symbol = symbol;
            @this.source_reference  = source;
            return(@this);
        }
Пример #2
0
        public override DataType copy()
        {
            var result = new UnresolvedType();

            result.source_reference  = source_reference;
            result.value_owned       = value_owned;
            result.nullable          = nullable;
            result.is_dynamic        = is_dynamic;
            result.unresolved_symbol = unresolved_symbol.copy();

            foreach (DataType arg in get_type_arguments())
            {
                result.add_type_argument(arg.copy());
            }

            return(result);
        }
Пример #3
0
        /// <summary>
        /// Creates a new type reference from a code expression.
        ///
        /// <param name="expr">member access expression</param>
        /// <returns>newly created type reference</returns>
        /// </summary>
        public static UnresolvedType new_from_expression(Expression expr)
        {
            var sym = UnresolvedSymbol.new_from_expression(expr);

            if (sym != null)
            {
                var type_ref = UnresolvedType.from_symbol(sym, expr.source_reference);
                type_ref.value_owned = true;

                var ma = (MemberAccess)expr;
                foreach (DataType arg in ma.get_type_arguments())
                {
                    type_ref.add_type_argument(arg);
                }

                return(type_ref);
            }

            return(null);
        }