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); } }
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; } }
private bool Equals(ArraySymbol other) { return(base.Equals(other) && Equals(ValueType, other.ValueType) && Dimension == other.Dimension); }
private bool Equals(ArraySymbol other) { return base.Equals(other) && Equals(ValueType, other.ValueType) && Dimension == other.Dimension; }
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; }