parent
682c640d29
commit
24dd7a8f94
|
|
@ -1698,7 +1698,16 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
object[] objs = new object[cnsts.Length];
|
object[] objs = new object[cnsts.Length];
|
||||||
for (int i = 0; i < objs.Length; i++)
|
for (int i = 0; i < objs.Length; i++)
|
||||||
{
|
{
|
||||||
objs[i] = cnsts[i].value;
|
if (cnsts[i] is IArrayConstantNode)
|
||||||
|
{
|
||||||
|
List<object> lst = new List<object>();
|
||||||
|
var arr_cnst = cnsts[i] as IArrayConstantNode;
|
||||||
|
foreach (IConstantNode cn in arr_cnst.ElementValues)
|
||||||
|
lst.Add(cn.value);
|
||||||
|
objs[i] = lst.ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
objs[i] = cnsts[i].value;
|
||||||
}
|
}
|
||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
TestSuite/attributes2.pas
Normal file
14
TestSuite/attributes2.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
//nopabcrtl
|
||||||
|
uses NUnitABC;
|
||||||
|
|
||||||
|
type TClass = class
|
||||||
|
public
|
||||||
|
[Test, Combinatorial]
|
||||||
|
static procedure TestPrime4([ValuesAttribute(1,2,3,4)] a: real);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
TClass.TestPrime4(2);
|
||||||
|
end.
|
||||||
10
TestSuite/errors/err0378.pas
Normal file
10
TestSuite/errors/err0378.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
uses NUnitABC;
|
||||||
|
|
||||||
|
[Test, Combinatorial]
|
||||||
|
procedure TestPrime4([Values(a)] a: real;
|
||||||
|
[RangeAttribute(1,200)] b: real);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
@ -12204,8 +12204,25 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
attribute_node attr_node = new attribute_node(bfc.simple_function_node, tn, get_location(attr));
|
attribute_node attr_node = new attribute_node(bfc.simple_function_node, tn, get_location(attr));
|
||||||
foreach (expression_node en in bfc.parameters)
|
foreach (expression_node en in bfc.parameters)
|
||||||
{
|
{
|
||||||
constant_node cn = convert_strong_to_constant_node(en, en.type);
|
constant_node cn = null;
|
||||||
check_for_strong_constant(cn, en.location);
|
if (en is array_initializer)
|
||||||
|
{
|
||||||
|
List<constant_node> cnst_list = new List<constant_node>();
|
||||||
|
foreach (expression_node ex in (en as array_initializer).element_values)
|
||||||
|
{
|
||||||
|
constant_node elem_cn = convert_strong_to_constant_node(ex, ex.type);
|
||||||
|
check_for_strong_constant(elem_cn, ex.location);
|
||||||
|
cnst_list.Add(elem_cn);
|
||||||
|
}
|
||||||
|
|
||||||
|
cn = convert_strong_to_constant_node(new array_const(cnst_list, en.location), en.type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cn = convert_strong_to_constant_node(en, en.type);
|
||||||
|
check_for_strong_constant(cn, en.location);
|
||||||
|
}
|
||||||
|
|
||||||
attr_node.args.Add(cn);
|
attr_node.args.Add(cn);
|
||||||
}
|
}
|
||||||
if (attr.arguments != null)
|
if (attr.arguments != null)
|
||||||
|
|
@ -14227,10 +14244,6 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
foreach (SyntaxTree.ident id in _typed_parametres.idents.idents)
|
foreach (SyntaxTree.ident id in _typed_parametres.idents.idents)
|
||||||
{
|
{
|
||||||
com_par = context.add_parameter(id.name, par_type, cpt, get_location(id));
|
com_par = context.add_parameter(id.name, par_type, cpt, get_location(id));
|
||||||
if (_typed_parametres.attributes != null)
|
|
||||||
{
|
|
||||||
make_attributes_for_declaration(_typed_parametres, com_par);
|
|
||||||
}
|
|
||||||
if (is_params)
|
if (is_params)
|
||||||
{
|
{
|
||||||
com_par.intrenal_is_params = true;
|
com_par.intrenal_is_params = true;
|
||||||
|
|
@ -14258,7 +14271,17 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
com_par.type = tn;
|
com_par.type = tn;
|
||||||
|
foreach (SyntaxTree.ident id in _typed_parametres.idents.idents)
|
||||||
|
{
|
||||||
|
if (_typed_parametres.attributes != null)
|
||||||
|
{
|
||||||
|
make_attributes_for_declaration(_typed_parametres, com_par);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
com_par.type = tn;
|
||||||
context.in_parameters_block = true;
|
context.in_parameters_block = true;
|
||||||
|
|
||||||
//TODO: Доделать параметры со значениями по умолчанию.
|
//TODO: Доделать параметры со значениями по умолчанию.
|
||||||
if (_typed_parametres.inital_value != null)
|
if (_typed_parametres.inital_value != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue