This commit is contained in:
parent
f4558af026
commit
5811692ca9
|
|
@ -1181,7 +1181,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
else
|
||||
fb.SetConstant(constant_value.value);
|
||||
}
|
||||
else if (!(constant_value is INullConstantNode))
|
||||
else if (!(constant_value is INullConstantNode) && constant_value.value != null)
|
||||
{
|
||||
if (constant_value.value.GetType() != t)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: DESKTOP-2BJCJ7I
|
||||
// DateTime: 05.04.2021 11:40:44
|
||||
// DateTime: 05.04.2021 12:23:25
|
||||
// UserName: ibond
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -967,6 +967,8 @@ const_factor
|
|||
}
|
||||
| new_expr
|
||||
{ $$ = $1; }
|
||||
| default_expr
|
||||
{ $$ = $1; }
|
||||
// | tkDeref const_factor
|
||||
// {
|
||||
// $$ = new roof_dereference($2 as addressed_value, @$);
|
||||
|
|
@ -2315,8 +2317,6 @@ typed_const_plus
|
|||
{ $$ = $1; }
|
||||
/*| new_expr
|
||||
{ $$ = $1; }*/
|
||||
| default_expr
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
constr_destr_decl
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
34
TestSuite/default2.pas
Normal file
34
TestSuite/default2.pas
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
procedure Test;
|
||||
const
|
||||
x1 = default(integer)+1;
|
||||
x2: integer = default(integer)+1;
|
||||
x3 = default(integer);
|
||||
x4 = default(string);
|
||||
x5 = default(object);
|
||||
x6 = default(integer) + default(real);
|
||||
begin
|
||||
assert(x1 = 1);
|
||||
assert(x2 = 1);
|
||||
assert(x3 = 0);
|
||||
assert(x4 = nil);
|
||||
assert(x5 = nil);
|
||||
assert(abs(x6) < 0.000001);
|
||||
end;
|
||||
|
||||
const
|
||||
x1 = default(integer)+1;
|
||||
x2: integer = default(integer)+1;
|
||||
x3 = default(integer);
|
||||
x4 = default(string);
|
||||
x5 = default(object);
|
||||
x6 = default(integer) + default(real);
|
||||
|
||||
begin
|
||||
assert(x1 = 1);
|
||||
assert(x2 = 1);
|
||||
assert(x3 = 0);
|
||||
assert(x4 = nil);
|
||||
assert(x5 = nil);
|
||||
assert(abs(x6) < 0.000001);
|
||||
Test;
|
||||
end.
|
||||
Loading…
Reference in a new issue