示例#1
0
        private void BindGlobalVariable(VariableDeclarationStatementSyntax variableDeclarationStatementSyntax)
        {
            var declaration = variableDeclarationStatementSyntax.Declaration;
            foreach (var declarator in declaration.Variables)
            {
                var variableType = _symbolSet.ResolveType(declaration.Type, null, null);

                foreach (var arrayRankSpecifier in declarator.ArrayRankSpecifiers)
                    variableType = new ArraySymbol(variableType);

                var symbol = new GlobalVariableSymbol(declarator, variableType);
                _bindingResult.AddSymbol(declarator, symbol);

                _symbolSet.AddGlobal(symbol);
            }
        }
示例#2
0
        private IEnumerable<FieldSymbol> BindFields(VariableDeclarationStatementSyntax variableDeclarationStatementSyntax, TypeSymbol parentType)
        {
            var declaration = variableDeclarationStatementSyntax.Declaration;
            foreach (var declarator in declaration.Variables)
            {
                var variableType = _symbolSet.ResolveType(declaration.Type, null, null);

                foreach (var arrayRankSpecifier in declarator.ArrayRankSpecifiers)
                    variableType = new ArraySymbol(variableType);

                var symbol = new SourceFieldSymbol(declarator, parentType, variableType);
                _bindingResult.AddSymbol(declarator, symbol);

                yield return symbol;
            }
        }
示例#3
0
 private bool Equals(ArraySymbol other)
 {
     return(base.Equals(other) &&
            Equals(ValueType, other.ValueType) &&
            Dimension == other.Dimension);
 }
示例#4
0
 private bool Equals(ArraySymbol other)
 {
     return base.Equals(other) 
         && Equals(ValueType, other.ValueType) 
         && Dimension == other.Dimension;
 }
示例#5
0
 private TypeSymbol BindArrayRankSpecifiers(List<ArrayRankSpecifierSyntax> arrayRankSpecifiers, TypeSymbol variableType)
 {
     foreach (var arrayRankSpecifier in arrayRankSpecifiers)
     {
         int? dimension = null;
         if (arrayRankSpecifier.Dimension != null)
         {
             var boundRankSpecifier = Bind(arrayRankSpecifier.Dimension, BindExpression);
             if (boundRankSpecifier.Kind == BoundNodeKind.LiteralExpression)
                 dimension = Convert.ToInt32(((BoundLiteralExpression) boundRankSpecifier).Value);
         }
         variableType = new ArraySymbol(variableType, dimension);
     }
     return variableType;
 }