public UserVariableDefinition(StructDeclaratorSyntax declarator, IdentifierSyntax identifier, string documentation, DefinitionKind kind, Scope scope) : base(documentation, kind, scope, identifier.Span) { if (kind == DefinitionKind.LocalVariable) { this.Name = ColoredString.Create(identifier.Identifier, ColorType.LocalVariable); } else { this.Name = ColoredString.Create(identifier.Identifier, ColorType.GlobalVariable); } InterfaceBlockSyntax block = declarator.Parent as InterfaceBlockSyntax; this.TypeQualifiers = block.TypeQualifier?.ToSyntaxTypes() ?? new List <SyntaxType>(); this.Type = new TypeDefinition(SyntaxType.TypeName); List <ColoredString> arraySpecifiers = new List <ColoredString>(); for (int i = 0; i < declarator.ArraySpecifiers.Count; i++) { arraySpecifiers.AddRange(declarator.ArraySpecifiers[i].ToColoredString()); } this.ArraySpecifiers = arraySpecifiers; }
public UserFieldDefinition(StructDeclaratorSyntax field, IdentifierSyntax identifier, string documentation, Scope scope) : base((field.Parent as StructDeclarationSyntax).TypeQualifier?.ToSyntaxTypes(), new TypeDefinition((field.Parent as StructDeclarationSyntax).TypeSyntax), identifier.Identifier, documentation, scope, identifier.Span) { List <ColoredString> arraySpecifiers = new List <ColoredString>(); for (int i = 0; i < field.ArraySpecifiers.Count; i++) { arraySpecifiers.AddRange(field.ArraySpecifiers[i].ToColoredString()); } this.ArraySpecifiers = arraySpecifiers; }