From 87f4005e0a8a1d60ebf411632d1a4007a95e02fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Fri, 26 May 2017 14:35:59 +0200 Subject: [PATCH] PascalABCVersion is intrinsic function (bug fix #395) --- TreeConverter/SystemLib/SystemLibInitializer.cs | 1 + .../TreeConversion/compiler_string_consts.cs | 1 + TreeConverter/TreeConversion/syntax_tree_visitor.cs | 13 ++++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/TreeConverter/SystemLib/SystemLibInitializer.cs b/TreeConverter/SystemLib/SystemLibInitializer.cs index fbbf528b7..38b9ea808 100644 --- a/TreeConverter/SystemLib/SystemLibInitializer.cs +++ b/TreeConverter/SystemLib/SystemLibInitializer.cs @@ -307,6 +307,7 @@ namespace PascalABCCompiler.SystemLibrary public static UnitDefinitionItem OMP_Available; public static UnitDefinitionItem OMP_ParallelFor; public static UnitDefinitionItem OMP_ParallelSections; + public static UnitDefinitionItem PascalABCVersion; //native--> public static UnitDefinitionItem ObjectType; public static UnitDefinitionItem StringType; diff --git a/TreeConverter/TreeConversion/compiler_string_consts.cs b/TreeConverter/TreeConversion/compiler_string_consts.cs index c0e90a0be..9822ca1b2 100644 --- a/TreeConverter/TreeConversion/compiler_string_consts.cs +++ b/TreeConverter/TreeConversion/compiler_string_consts.cs @@ -411,6 +411,7 @@ namespace PascalABCCompiler.TreeConverter public static string PointerToStringFunction_func_name = "PointerToString"; public static string GetRuntimeSizeFunction_func_name = "GetRuntimeSize"; public static string StrProcedure_func_name = "Str"; + public static string PascalABCVersion_func_name = "PascalABCVersion"; public static string ChrUnicodeFunction_func_name = "ChrUnicode"; public static string ExceptionName = "System.Exception"; public static string value_in_accessor_name = "$value"; diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 2bb3d8339..dd59bccbd 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -285,6 +285,7 @@ namespace PascalABCCompiler.TreeConverter SystemLibrary.SystemLibInitializer.ObjectType = null; SystemLibrary.SystemLibInitializer.StringType = null; SystemLibrary.SystemLibInitializer.ConfigVariable = null; + SystemLibrary.SystemLibInitializer.PascalABCVersion = null; } internal bool SystemUnitAssigned = false; @@ -360,6 +361,7 @@ namespace PascalABCCompiler.TreeConverter SystemLibrary.SystemLibInitializer.PointerToStringFunction = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.PointerToStringFunction_func_name); SystemLibrary.SystemLibInitializer.GetRuntimeSizeFunction = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.GetRuntimeSizeFunction_func_name); SystemLibrary.SystemLibInitializer.StrProcedure = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.StrProcedure_func_name); + SystemLibrary.SystemLibInitializer.PascalABCVersion = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.PascalABCVersion_func_name); SystemLibrary.SystemLibInitializer.ChrUnicodeFunction = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.ChrUnicodeFunction_func_name); SystemLibrary.SystemLibInitializer.AssertProcedure = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.AssertProcedure); SystemLibrary.SystemLibInitializer.CheckRangeFunction = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.check_in_range); @@ -453,6 +455,7 @@ namespace PascalABCCompiler.TreeConverter SystemLibrary.SystemLibInitializer.PointerToStringFunction = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.PointerToStringFunction_func_name); SystemLibrary.SystemLibInitializer.GetRuntimeSizeFunction = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.GetRuntimeSizeFunction_func_name); SystemLibrary.SystemLibInitializer.StrProcedure = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.StrProcedure_func_name); + SystemLibrary.SystemLibInitializer.PascalABCVersion = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.PascalABCVersion_func_name); SystemLibrary.SystemLibInitializer.ChrUnicodeFunction = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.ChrUnicodeFunction_func_name); SystemLibrary.SystemLibInitializer.AssertProcedure = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.AssertProcedure); SystemLibrary.SystemLibInitializer.CheckRangeFunction = new SystemLibrary.UnitDefinitionItem(psystem_unit, compiler_string_consts.check_in_range); @@ -5980,6 +5983,11 @@ namespace PascalABCCompiler.TreeConverter { is_format_allowed = true; } + else if (SystemLibrary.SystemLibInitializer.PascalABCVersion.Equal(si)) + { + return_value(new string_const_node(RevisionClass.FullVersion, get_location(_method_call))); + return; + } else if (SystemLibrary.SystemLibInitializer.ArrayCopyFunction.Equal(si)) { if (_method_call.parameters != null && _method_call.parameters.expressions.Count == 1) @@ -15194,7 +15202,10 @@ namespace PascalABCCompiler.TreeConverter { //return convertion_data_and_alghoritms.create_full_function_call(new expressions_list(), // si,lloc,blocks.converted_type,blocks.top_function,false); - + if (SystemUnitAssigned && SystemLibrary.SystemLibInitializer.PascalABCVersion.Equal(si)) + { + return new string_const_node(RevisionClass.FullVersion, get_location(_ident)); + } if (si.sym_info == SystemLibrary.SystemLibInitializer.NewProcedure.sym_info) { AddError(lloc, "EXPECTED_TYPE_AFTER_NEW");