diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index 29dbe6acf..91821ad20 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -3062,13 +3062,18 @@ namespace CodeCompletion if (_class_definition.keyword == class_keyword.Record) { ss = new TypeScope(SymbolKind.Struct, cur_scope, returned_scope); - if (cur_type_name == null) cur_type_name = "$record"; + if (cur_type_name == null) + cur_type_name = "$record"; } else if (_class_definition.keyword == class_keyword.Class) { ss = new TypeScope(SymbolKind.Class, cur_scope, returned_scope); - if (_class_definition.attribute == class_attribute.Sealed) ss.is_final = true; - if (cur_type_name == null) cur_type_name = "$class"; + if ((_class_definition.attribute & class_attribute.Sealed) == class_attribute.Sealed) + ss.is_final = true; + if ((_class_definition.attribute & class_attribute.Abstract) == class_attribute.Abstract) + ss.is_abstract = true; + if (cur_type_name == null) + cur_type_name = "$class"; } else if (_class_definition.keyword == class_keyword.Interface || _class_definition.keyword == class_keyword.TemplateInterface) { diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index 93a55661d..2f1f824d9 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -3653,6 +3653,14 @@ namespace CodeCompletion } } + public virtual bool IsAbstract + { + get + { + return is_abstract; + } + } + public virtual ITypeScope[] GenericInstances { get @@ -4883,6 +4891,14 @@ namespace CodeCompletion } } + public override bool IsAbstract + { + get + { + return ctn.IsAbstract; + } + } + public Type CompiledType { get diff --git a/ParserTools/ParserTools/DefaultLanguageInformation.cs b/ParserTools/ParserTools/DefaultLanguageInformation.cs index 6f53a96c1..34934c69f 100644 --- a/ParserTools/ParserTools/DefaultLanguageInformation.cs +++ b/ParserTools/ParserTools/DefaultLanguageInformation.cs @@ -973,8 +973,8 @@ namespace PascalABCCompiler.Parsers { case SymbolKind.Class : if (scope.TopScope != null && scope.TopScope.Name != "" && !scope.TopScope.Name.Contains("$")) - return (scope.IsFinal?"final ":"")+"class "+scope.TopScope.Name + "." +scope.Name+template_str; - else return (scope.IsFinal?"final ":"")+"class "+scope.Name+template_str; + return (scope.IsAbstract ? "abstract " : "") + (scope.IsFinal?"sealed ":"")+"class "+scope.TopScope.Name + "." +scope.Name+template_str; + else return (scope.IsAbstract ? "abstract " : "") + (scope.IsFinal?"sealed ":"")+"class "+scope.Name+template_str; case SymbolKind.Interface : if (scope.TopScope != null && scope.TopScope.Name != "" && !scope.TopScope.Name.Contains("$")) return "interface "+scope.TopScope.Name + "." +scope.Name+template_str; @@ -1031,7 +1031,7 @@ namespace PascalABCCompiler.Parsers switch(scope.ElemKind) { case SymbolKind.Class : - return (scope.IsFinal?"final ":"")+"class "+s; + return (scope.IsAbstract ? "abstract " : "")+(scope.IsFinal?"sealed ":"")+"class "+s; case SymbolKind.Interface : return "interface "+s; case SymbolKind.Enum : @@ -3623,8 +3623,8 @@ namespace PascalABCCompiler.Parsers { case SymbolKind.Class : if (scope.TopScope != null && scope.TopScope.Name != "") - return (scope.IsFinal?"sealed ":"")+"class "+scope.TopScope.Name + "::" +scope.Name+template_str; - else return (scope.IsFinal?"sealed ":"")+"class "+scope.Name+template_str; + return (scope.IsAbstract ? "abstract " : "") + (scope.IsFinal?"sealed ":"")+"class "+scope.TopScope.Name + "::" +scope.Name+template_str; + else return (scope.IsAbstract ? "abstract " : "") + (scope.IsFinal?"sealed ":"")+"class "+scope.Name+template_str; case SymbolKind.Interface : if (scope.TopScope != null && scope.TopScope.Name != "") return "interface class"+scope.TopScope.Name + "::" +scope.Name+template_str; diff --git a/ParserTools/ParserTools/LanguageInformation.cs b/ParserTools/ParserTools/LanguageInformation.cs index ff9a00d0e..0003567bd 100644 --- a/ParserTools/ParserTools/LanguageInformation.cs +++ b/ParserTools/ParserTools/LanguageInformation.cs @@ -654,8 +654,13 @@ namespace PascalABCCompiler.Parsers { get; } - - string[] TemplateArguments + + bool IsAbstract + { + get; + } + + string[] TemplateArguments { get; } diff --git a/TestSuite/intellisense_tests/class1.pas b/TestSuite/intellisense_tests/class1.pas index b13bebb61..5a6e63fff 100644 --- a/TestSuite/intellisense_tests/class1.pas +++ b/TestSuite/intellisense_tests/class1.pas @@ -17,5 +17,5 @@ begin var t3: TArr2{@type TArr2 = array[,] of TArr@}; var t4: TArr3{@type TArr3 = array[1..10] of string@}; var t5: TStr{@type TStr = string[5]@}; - var sb: StringBuilder{@final class System.Text.StringBuilder@}; + var sb: StringBuilder{@sealed class System.Text.StringBuilder@}; end. \ No newline at end of file