diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index d299ea914..fc2b55a8c 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "4"; public const string Build = "0"; - public const string Revision = "1706"; + public const string Revision = "1712"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index d684a80e9..82a4a85ae 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %MINOR%=4 -%REVISION%=1706 +%REVISION%=1712 %COREVERSION%=0 %MAJOR%=3 diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index 0dabee9b6..6c50df717 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs @@ -2,7 +2,7 @@ // This CSharp output file generated by Gardens Point LEX // Version: 1.1.3.301 // Machine: DESKTOP-A6LT9RI -// DateTime: 12.07.2018 11:09:32 +// DateTime: 17.07.2018 15:09:39 // UserName: ????????? // GPLEX input file // GPLEX frame file diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index a322ff41f..4bb4a820f 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -2,7 +2,7 @@ // GPPG version 1.3.6 // Machine: DESKTOP-A6LT9RI -// DateTime: 12.07.2018 11:09:33 +// DateTime: 17.07.2018 15:09:39 // UserName: ????????? // Input file diff --git a/Parsers/PascalABCParserNewSaushkin/PABC.ymc b/Parsers/PascalABCParserNewSaushkin/PABC.ymc index 9ee3f6a65..9855a882a 100644 --- a/Parsers/PascalABCParserNewSaushkin/PABC.ymc +++ b/Parsers/PascalABCParserNewSaushkin/PABC.ymc @@ -200,5 +200,6 @@ script= + diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index e87c924d1..f5fc38a6b 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.4.0.1706' +!define VERSION '3.4.0.1712' diff --git a/TestSuite/CompilationSamples/MPI.pas b/TestSuite/CompilationSamples/MPI.pas index 1218ba667..5b974e4c9 100644 --- a/TestSuite/CompilationSamples/MPI.pas +++ b/TestSuite/CompilationSamples/MPI.pas @@ -1,4 +1,4 @@ -// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt) +// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) unit MPI; @@ -77,7 +77,7 @@ const MPI_GROUP_NULL = 0; MPI_DATATYPE_NULL = 0; MPI_REQUEST_NULL = 0; - MPI_BOTTOM = pointer(0); + MPI_BOTTOM: pointer = nil; MPI_ERRORS_ARE_FATAL = 119; MPI_ERRORS_RETURN = 120; diff --git a/TestSuite/CompilationSamples/NewLife.pas b/TestSuite/CompilationSamples/NewLife.pas index f4bc91131..66a60deab 100644 --- a/TestSuite/CompilationSamples/NewLife.pas +++ b/TestSuite/CompilationSamples/NewLife.pas @@ -1,4 +1,4 @@ -// Игра Жизнь на торе +// Игра Жизнь на торе // Оптимизация хешированием по равномерной сетке @@ -19,8 +19,9 @@ const y0=21; ClearColor=clBlack; FillColor=clLimeGreen; - FiledColor=RGB(0,40,0); - FiledColor2=RGB(0,70,0);{} +var + FiledColor := RGB(0,40,0); + FiledColor2 := RGB(0,70,0);{} {ClearColor=clWhite; FillColor=clBlack; FiledColor=clLightGray; diff --git a/TestSuite/CompilationSamples/graph3d.pas b/TestSuite/CompilationSamples/graph3d.pas index 778b9705b..893a61f81 100644 --- a/TestSuite/CompilationSamples/graph3d.pas +++ b/TestSuite/CompilationSamples/graph3d.pas @@ -80,12 +80,12 @@ function operator+(p1, p2: Point3D): Point3D; extensionmethod := p3d(p1.X + p2.X function operator-(v: Vector3D): Vector3D; extensionmethod := v3d(-v.x,-v.y,-v.z); -const - OrtX = V3D(1, 0, 0); - OrtY = V3D(0, 1, 0); - OrtZ = V3D(0, 0, 1); - Origin: Point3D = P3D(0, 0, 0); - EmptyColor = ARGB(0, 0, 0, 0); +var + OrtX := V3D(1, 0, 0); + OrtY := V3D(0, 1, 0); + OrtZ := V3D(0, 0, 1); + Origin: Point3D := P3D(0, 0, 0); + EmptyColor := ARGB(0, 0, 0, 0); function ChangeOpacity(Self: GColor; value: integer); extensionmethod := ARGB(value, Self.R, Self.G, Self.B); diff --git a/TestSuite/errors/err0243_const_fun.pas b/TestSuite/errors/err0243_const_fun.pas index f06cdd8a2..9caa899cd 100644 --- a/TestSuite/errors/err0243_const_fun.pas +++ b/TestSuite/errors/err0243_const_fun.pas @@ -1,4 +1,6 @@ -const a = Sin(0); +function f := 666; + +const a = f(); begin end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index eca9429be..94351fbcc 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -13628,7 +13628,15 @@ namespace PascalABCCompiler.TreeConverter private constant_node convert_strong_to_constant_node(SyntaxTree.expression expr) { expression_node exp = convert_strong(expr); - return convert_strong_to_constant_node(exp, exp.type); + var is_const_section = (expr.Parent != null && (expr.Parent is const_definition)); + + var is_userdefined = false; + var cnf = exp as common_namespace_function_call; + if (cnf != null) + { + is_userdefined = ! (cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem") || cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem_implementation______")); + } + return convert_strong_to_constant_node(exp, exp.type, is_const_section && is_userdefined); } public expression_node convert_strong_to_constant_or_function_call_for_varinit(expression_node exp) @@ -13737,7 +13745,17 @@ namespace PascalABCCompiler.TreeConverter private constant_node convert_strong_to_constant_node(SyntaxTree.expression expr, type_node tn) { - return convert_strong_to_constant_node(convert_strong(expr), tn); + var exp = convert_strong(expr); + var is_const_section = (expr.Parent != null && (expr.Parent is const_definition)); + + var is_userdefined = false; + var cnf = exp as common_namespace_function_call; + if (cnf != null) + { + is_userdefined = !(cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem") || cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem_implementation______")); + } + + return convert_strong_to_constant_node(exp, tn, is_const_section && is_userdefined); } private void check_set_for_constant(common_namespace_function_call cnfc) @@ -13763,7 +13781,7 @@ namespace PascalABCCompiler.TreeConverter if (!(en is constant_node /*|| en is statements_expression_node*/)) AddError(en.location, "CONSTANT_EXPRESSION_EXPECTED"); } - private constant_node convert_strong_to_constant_node(expression_node expr, type_node tn) + private constant_node convert_strong_to_constant_node(expression_node expr, type_node tn, bool is_const_section_and_userfuncall = false) { location loc = expr.location; constant_node constant = null; @@ -13798,13 +13816,15 @@ namespace PascalABCCompiler.TreeConverter } constant = new common_namespace_function_call_as_constant(cnfc, loc); } - /*else if (expr is basic_function_call || expr is common_namespace_function_call) // Ниже вроде есть закомментированный код, делающий это + else if (is_const_section_and_userfuncall && (expr is basic_function_call || expr is common_namespace_function_call)) // только в разделе const { AddError(loc, "CONSTANT_EXPRESSION_EXPECTED"); - }*/ + } else if (expr is common_namespace_function_call) { common_namespace_function_call cnfc=expr as common_namespace_function_call; + foreach (expression_node el in cnfc.parameters) + convert_strong_to_constant_node(el, el.type); //if (cnfc.function_node.namespace_node == context.converted_namespace) // AddError(loc, "CONSTANT_EXPRESSION_EXPECTED"); // throw new ConstantExpressionExpected(loc); diff --git a/bin/Lib/Graph3D.pas b/bin/Lib/Graph3D.pas index 778b9705b..893a61f81 100644 --- a/bin/Lib/Graph3D.pas +++ b/bin/Lib/Graph3D.pas @@ -80,12 +80,12 @@ function operator+(p1, p2: Point3D): Point3D; extensionmethod := p3d(p1.X + p2.X function operator-(v: Vector3D): Vector3D; extensionmethod := v3d(-v.x,-v.y,-v.z); -const - OrtX = V3D(1, 0, 0); - OrtY = V3D(0, 1, 0); - OrtZ = V3D(0, 0, 1); - Origin: Point3D = P3D(0, 0, 0); - EmptyColor = ARGB(0, 0, 0, 0); +var + OrtX := V3D(1, 0, 0); + OrtY := V3D(0, 1, 0); + OrtZ := V3D(0, 0, 1); + Origin: Point3D := P3D(0, 0, 0); + EmptyColor := ARGB(0, 0, 0, 0); function ChangeOpacity(Self: GColor; value: integer); extensionmethod := ARGB(value, Self.R, Self.G, Self.B); diff --git a/bin/Lib/MPI.pas b/bin/Lib/MPI.pas index 1218ba667..5b974e4c9 100644 --- a/bin/Lib/MPI.pas +++ b/bin/Lib/MPI.pas @@ -1,4 +1,4 @@ -// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt) +// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) unit MPI; @@ -77,7 +77,7 @@ const MPI_GROUP_NULL = 0; MPI_DATATYPE_NULL = 0; MPI_REQUEST_NULL = 0; - MPI_BOTTOM = pointer(0); + MPI_BOTTOM: pointer = nil; MPI_ERRORS_ARE_FATAL = 119; MPI_ERRORS_RETURN = 120;