PVS - основные рекомендации из статьи 2022 года на Хабре

This commit is contained in:
Mikhalkovich Stanislav 2022-01-28 11:55:37 +03:00
parent 8308779cfe
commit aaac633fcd
10 changed files with 17 additions and 13 deletions

View file

@ -2193,7 +2193,7 @@ namespace PascalABCCompiler
string pdb_file_name=Path.ChangeExtension(CompilerOptions.OutputFileName, ".pdb"); string pdb_file_name=Path.ChangeExtension(CompilerOptions.OutputFileName, ".pdb");
if (File.Exists(pdb_file_name)) if (File.Exists(pdb_file_name))
File.Delete(pdb_file_name); File.Delete(pdb_file_name);
n = 5; n = 5; // PVS 01/2022
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -85,7 +85,7 @@ namespace PascalABCCompiler
string inputId = "pabcnetc_input"; string inputId = "pabcnetc_input";
string pabcnetcFileName = "pabcnetc.exe"; string pabcnetcFileName = "pabcnetc.exe";
public const int sendCommandStartNumber = 100; public const int sendCommandStartNumber = 100;
public CompilerState compilerState = CompilerState.Reloading; public volatile CompilerState compilerState = CompilerState.Reloading; // PVS 01/2022 volatile
Encoding inputEncoding = System.Text.Encoding.UTF8; Encoding inputEncoding = System.Text.Encoding.UTF8;
bool compilationSatarted = false; bool compilationSatarted = false;

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3"; public const string Major = "3";
public const string Minor = "8"; public const string Minor = "8";
public const string Build = "2"; public const string Build = "2";
public const string Revision = "3063"; public const string Revision = "3065";
public const string MainVersion = Major + "." + Minor; public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=8 %MINOR%=8
%REVISION%=3063 %REVISION%=3065
%COREVERSION%=2 %COREVERSION%=2
%MAJOR%=3 %MAJOR%=3

View file

@ -8561,7 +8561,11 @@ namespace PascalABCCompiler.NETGenerator
} }
//ICompiledTypeNode ctn = from.type as ICompiledTypeNode; //ICompiledTypeNode ctn = from.type as ICompiledTypeNode;
ICompiledTypeNode ctn2 = to.type as ICompiledTypeNode; ICompiledTypeNode ctn2 = to.type as ICompiledTypeNode;
if ((from.type.is_value_type || from.type.is_generic_parameter) && ctn2 != null && (ctn2.compiled_type == TypeFactory.ObjectType || (ctn2.compiled_type == TypeFactory.ObjectType || ctn2.compiled_type.IsInterface))) if ((from.type.is_value_type || from.type.is_generic_parameter) &&
ctn2 != null &&
(ctn2.compiled_type == TypeFactory.ObjectType ||
(ctn2.compiled_type == TypeFactory.ObjectType || ctn2.compiled_type.IsInterface))
)
{ {
il.Emit(OpCodes.Box, helper.GetTypeReference(from.type).tp); il.Emit(OpCodes.Box, helper.GetTypeReference(from.type).tp);
} }

View file

@ -1 +1 @@
3.8.2.3063 3.8.2.3065

View file

@ -1 +1 @@
!define VERSION '3.8.2.3063' !define VERSION '3.8.2.3065'

View file

@ -867,9 +867,9 @@ namespace SymbolTable
private Scope FindClassScope(Scope scope) private Scope FindClassScope(Scope scope)
{ {
while (scope != null && !(scope is ClassScope)) while (scope != null && !(scope is ClassScope))
if(scope is ClassMethodScope) /*if(scope is ClassMethodScope)
scope = scope.TopScope; scope = scope.TopScope;
else else*/ // PVS 01/2022
scope = scope.TopScope; scope = scope.TopScope;
return scope; return scope;
} }

View file

@ -427,7 +427,7 @@ namespace PascalABCCompiler.TreeRealization
} }
catch(Exception e) catch(Exception e)
{ {
e = e; // e = e; // PVS 01/2022
} }
} }
else else

View file

@ -595,10 +595,10 @@ namespace VisualPascalABCPlugins
tn.Text = collection_name + " Count : " + num.ToString(); tn.Text = collection_name + " Count : " + num.ToString();
tn.Tag = icol; tn.Tag = icol;
if (t != null) /*if (t != null)
t.Nodes.Add(tn); t.Nodes.Add(tn);
else else*/ // PVS 01/2022
nodes.Add(tn); nodes.Add(tn);
foreach (ISemanticNode sn in icol) foreach (ISemanticNode sn in icol)
{ {
prepare_node_in_collection(sn, item_name + "[" + i.ToString() + "]", tn); prepare_node_in_collection(sn, item_name + "[" + i.ToString() + "]", tn);