Example #1
0
        /// <summary>
        /// Returns an enumeration of symbols from the specified types.
        /// </summary>
        public static IEnumerable <ISymbol> GetSymbolsFromTypes(ITypeChecker typeChecker, IEnumerable <IType> types)
        {
            HashSet <ISymbol> symbols = new HashSet <ISymbol>();

            foreach (var type in types)
            {
                symbols.AddRange(typeChecker.GetPropertiesOfType(type));
            }

            return(symbols);
        }
Example #2
0
        /// <summary>
        /// Given a <paramref name="type"/>, returns the symbols that can be accessed relative to <paramref name="node"/>
        /// </summary>
        /// <param name="type">The type whose symbols will be tested for valid property access.</param>
        /// <param name="node">The node in which the type's symbols will be accessed.</param>
        /// <param name="typeChecker">Reference to the type checker.</param>
        /// <remarks>
        /// Ported from TypeScript version.
        /// </remarks>
        private static IEnumerable <ISymbol> AddTypeProperties(IType type, INode node, ITypeChecker typeChecker)
        {
            var typeSymbols = typeChecker.GetPropertiesOfType(type);

            if (typeSymbols != null)
            {
                return(typeSymbols.Where(typeSymbol => typeSymbol.Name != null && typeChecker.IsValidPropertyAccess(node.Parent /*HINT: IPropertyAccessExpression*/, typeSymbol.Name)));
            }

            return(Enumerable.Empty <ISymbol>());
        }