This commit is contained in:
Бондарев Иван 2017-11-19 18:30:00 +01:00
parent 17b9e02eba
commit 2049edcf20
5 changed files with 37 additions and 11 deletions

View file

@ -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)
{

View file

@ -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

View file

@ -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;

View file

@ -654,8 +654,13 @@ namespace PascalABCCompiler.Parsers
{
get;
}
string[] TemplateArguments
bool IsAbstract
{
get;
}
string[] TemplateArguments
{
get;
}

View file

@ -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.