PABCSystem.pas убрал строки вызывавшие предупреждения

This commit is contained in:
miks1965 2016-08-29 21:57:57 +03:00
parent c92984982e
commit c3ea3b8c0f
7 changed files with 36 additions and 57 deletions

View file

@ -17,7 +17,7 @@ namespace PascalABCCompiler.SyntaxTree
public override void Enter(syntax_tree_node st)
{
base.Enter(st);
st.Parent = UpperNode();
//st.Parent = UpperNode();
}
}
}

View file

@ -917,7 +917,7 @@ namespace SyntaxVisitors
LoweringYieldSequenceVisitor.Accept(pd);
// frninja 31/05/16 - добавляем метод-хелпер, возьмет на себя проверку разных ошибок уже существующим бэкендом
//CreateErrorCheckerHelper(pd); // SSM 14/07/16 - переставил до переименования переменных чтобы отлавливались ошибки одинаковых имен в разных пространствах имен
CreateErrorCheckerHelper(pd); // SSM 14/07/16 - переставил до переименования переменных чтобы отлавливались ошибки одинаковых имен в разных пространствах имен
// SSM - можно сделать спец визитор, который бы отлавливал дубли имен - тогда этого не надо
// Переименовываем одинаковые имена в мини-ПИ: begin var a := 1 end; begin var a := 1 end;

View file

@ -910,10 +910,6 @@ procedure Seek(f: BinaryFile; n: int64);
procedure BinaryFileInit(var f: BinaryFile);
///--
function BinaryFileRead(var f: BinaryFile; ElementType: System.Type): object;
///--
function __GetCurrentLine__: integer;
///--
function __GetCurrentFile__: string;
// -----------------------------------------------------
//>> Cистемные подпрограммы # System subroutines
@ -1917,17 +1913,6 @@ const
// WINAPI
// -----------------------------------------------------
///--
function __GetCurrentLine__: integer;
begin
end;
///--
function __GetCurrentFile__: string;
begin
end;
function WINAPI_AllocConsole: longword; external 'kernel32.dll' name 'AllocConsole';
var console_alloc: boolean := false;
@ -6423,12 +6408,12 @@ procedure Assert(cond: boolean; sourceFile: string; line: integer);
begin
if (Environment.OSVersion.Platform = PlatformID.Unix) or (Environment.OSVersion.Platform = PlatformID.MacOSX) or IsWDE then
begin
var stackTrace := new System.Diagnostics.StackTrace(true);
var ind := 1;
if stackTrace.GetFrame(0).GetMethod().Name <> 'Assert' then
ind := 0;
var currentLine := stackTrace.GetFrame(ind).GetFileLineNumber();
var currentFile := stackTrace.GetFrame(ind).GetFileName();
//var stackTrace := new System.Diagnostics.StackTrace(true);
//var ind := 1;
//if stackTrace.GetFrame(0).GetMethod().Name <> 'Assert' then
//ind := 0;
//var currentLine := stackTrace.GetFrame(ind).GetFileLineNumber();
//var currentFile := stackTrace.GetFrame(ind).GetFileName();
if not IsWDE then
System.Diagnostics.Debug.Assert(cond,'Файл '+sourceFile+', строка '+line.ToString())
else if not cond then
@ -6447,12 +6432,12 @@ procedure Assert(cond: boolean; message: string; sourceFile: string; line: integ
begin
if (Environment.OSVersion.Platform = PlatformID.Unix) or (Environment.OSVersion.Platform = PlatformID.MacOSX) or IsWDE then
begin
var stackTrace := new System.Diagnostics.StackTrace(true);
var ind := 1;
if stackTrace.GetFrame(0).GetMethod().Name <> 'Assert' then
ind := 0;
var currentLine := stackTrace.GetFrame(ind).GetFileLineNumber();
var currentFile := stackTrace.GetFrame(ind).GetFileName();
//var stackTrace := new System.Diagnostics.StackTrace(true);
//var ind := 1;
//if stackTrace.GetFrame(0).GetMethod().Name <> 'Assert' then
// ind := 0;
//var currentLine := stackTrace.GetFrame(ind).GetFileLineNumber();
//var currentFile := stackTrace.GetFrame(ind).GetFileName();
if not IsWDE then
System.Diagnostics.Debug.Assert(cond,'Файл '+sourceFile+', строка '+line.ToString()+': '+message)
else if not cond then

View file

@ -70,7 +70,7 @@ namespace PascalABCCompiler.TreeConverter
}
//TODO: Исправить коллкцию модулей.
//TODO: Исправить коллекцию модулей.
public PascalABCCompiler.TreeRealization.common_unit_node CompileInterface(SyntaxTree.compilation_unit SyntaxUnit,
PascalABCCompiler.TreeRealization.unit_node_list UsedUnits, List<Errors.Error> ErrorsList, List<Errors.CompilerWarning> WarningsList, PascalABCCompiler.Errors.SyntaxError parser_error,
System.Collections.Hashtable bad_nodes, TreeRealization.using_namespace_list namespaces, Dictionary<SyntaxTree.syntax_tree_node,string> docs, bool debug, bool debugging)

View file

@ -13680,6 +13680,15 @@ namespace PascalABCCompiler.TreeConverter
expression_node condition = convert_strong(_if_node.condition);
condition = convertion_data_and_alghoritms.convert_type(condition, SystemLibrary.SystemLibrary.bool_type);
// SSM 29/08/16
var cc = condition as bool_const_node;
if (cc != null && cc.constant_value == false && _if_node.else_body == null)
{
// недостижимый код - ничего не генерировать
return_value(new empty_statement(get_location(_if_node)));
return;
}
CheckToEmbeddedStatementCannotBeADeclaration(_if_node.then_body);
CheckToEmbeddedStatementCannotBeADeclaration(_if_node.else_body);

Binary file not shown.

View file

@ -910,10 +910,6 @@ procedure Seek(f: BinaryFile; n: int64);
procedure BinaryFileInit(var f: BinaryFile);
///--
function BinaryFileRead(var f: BinaryFile; ElementType: System.Type): object;
///--
function __GetCurrentLine__: integer;
///--
function __GetCurrentFile__: string;
// -----------------------------------------------------
//>> Cистемные подпрограммы # System subroutines
@ -1917,17 +1913,6 @@ const
// WINAPI
// -----------------------------------------------------
///--
function __GetCurrentLine__: integer;
begin
end;
///--
function __GetCurrentFile__: string;
begin
end;
function WINAPI_AllocConsole: longword; external 'kernel32.dll' name 'AllocConsole';
var console_alloc: boolean := false;
@ -6423,12 +6408,12 @@ procedure Assert(cond: boolean; sourceFile: string; line: integer);
begin
if (Environment.OSVersion.Platform = PlatformID.Unix) or (Environment.OSVersion.Platform = PlatformID.MacOSX) or IsWDE then
begin
var stackTrace := new System.Diagnostics.StackTrace(true);
var ind := 1;
if stackTrace.GetFrame(0).GetMethod().Name <> 'Assert' then
ind := 0;
var currentLine := stackTrace.GetFrame(ind).GetFileLineNumber();
var currentFile := stackTrace.GetFrame(ind).GetFileName();
//var stackTrace := new System.Diagnostics.StackTrace(true);
//var ind := 1;
//if stackTrace.GetFrame(0).GetMethod().Name <> 'Assert' then
//ind := 0;
//var currentLine := stackTrace.GetFrame(ind).GetFileLineNumber();
//var currentFile := stackTrace.GetFrame(ind).GetFileName();
if not IsWDE then
System.Diagnostics.Debug.Assert(cond,'Файл '+sourceFile+', строка '+line.ToString())
else if not cond then
@ -6447,12 +6432,12 @@ procedure Assert(cond: boolean; message: string; sourceFile: string; line: integ
begin
if (Environment.OSVersion.Platform = PlatformID.Unix) or (Environment.OSVersion.Platform = PlatformID.MacOSX) or IsWDE then
begin
var stackTrace := new System.Diagnostics.StackTrace(true);
var ind := 1;
if stackTrace.GetFrame(0).GetMethod().Name <> 'Assert' then
ind := 0;
var currentLine := stackTrace.GetFrame(ind).GetFileLineNumber();
var currentFile := stackTrace.GetFrame(ind).GetFileName();
//var stackTrace := new System.Diagnostics.StackTrace(true);
//var ind := 1;
//if stackTrace.GetFrame(0).GetMethod().Name <> 'Assert' then
// ind := 0;
//var currentLine := stackTrace.GetFrame(ind).GetFileLineNumber();
//var currentFile := stackTrace.GetFrame(ind).GetFileName();
if not IsWDE then
System.Diagnostics.Debug.Assert(cond,'Файл '+sourceFile+', строка '+line.ToString()+': '+message)
else if not cond then