Exemplo n.º 1
0
        private Expression ProcessArrayTypeNode(ArrayTypeNode node) {
            TypeSymbol itemTypeSymbol = _symbolSet.ResolveType(node.BaseType, _symbolTable, _symbolContext);
            Debug.Assert(itemTypeSymbol != null);

            TypeSymbol arrayTypeSymbol = _symbolSet.CreateArrayTypeSymbol(itemTypeSymbol);

            return new TypeExpression(arrayTypeSymbol, SymbolFilter.Public | SymbolFilter.StaticMembers);
        }
Exemplo n.º 2
0
        private ParseNode ParseArrayRanks(ParseNode type) {
            if (PeekType() == TokenType.OpenSquare && (PeekType(1) == TokenType.Comma || PeekType(1) == TokenType.CloseSquare)) {
                CheckIsType(type, true);

                do {
                    NextToken();
                    int rank = 1;
                    while (null != EatOpt(TokenType.Comma)) {
                        rank += 1;
                    }
                    type = new ArrayTypeNode(type, rank);
                    Eat(TokenType.CloseSquare);
                } while (PeekType() == TokenType.OpenSquare && (PeekType(1) == TokenType.Comma || PeekType(1) == TokenType.CloseSquare));
            }
            return type;
        }