Commit ee1e85ce authored by Lenard Nagy's avatar Lenard Nagy
Browse files

Merge branch 'master' into 'master'

Added missing semantic errors to the create operation (bug 568899)

See merge request !158
parents 4fe9708d fff7715f
......@@ -5144,7 +5144,8 @@ namespace Common {
// convert the parameter list to component 'create' parameters
size_t nof_pars = u.expr.t_list2->get_nof_tis();
if (nof_pars > 2) {
// error
u.expr.t_list2->error("Operation `create' for a component type cannot have more than 2 parameters");
goto error;
}
else {
Value* name_val = NULL;
......@@ -5157,7 +5158,9 @@ namespace Common {
name_val = name_par->get_Template()->get_Value();
}
else {
// error
name_par->error("A specific value without matching symbols was expected for the "
"first parameter of operation `create'");
goto error;
}
}
if (nof_pars == 2) {
......@@ -5168,7 +5171,12 @@ namespace Common {
loc_val = loc_par->get_Template()->get_Value();
}
else {
// error
loc_par->error("A specific value without matching symbols was expected for the "
"second parameter of operation `create'");
if (name_val != NULL) {
delete name_val;
}
goto error;
}
}
}
......@@ -5181,7 +5189,8 @@ namespace Common {
}
else { // T_CLASS
if (u.expr.b4) { // 'alive' keyword is set
// error
error("Keyword `alive' cannot be used when creating an object of class type");
goto error;
}
u.expr.v_optype = OPTYPE_CLASS_CREATE;
}
......
......@@ -338,6 +338,13 @@ type class C20 extends C15 { //^In type definition//
create() : f_embedded_types() { } //^In constructor definition// //^In super-constructor call// //Reference to constructor was expected instead of function//
}
function f_create() { //^In function definition//
var C0 x1 := C0.create alive; //^In variable definition// //Keyword `alive' cannot be used when creating an object of class type//
var Comp c1 := Comp.create("a", "b", "c"); //^In variable definition// //Operation `create' for a component type cannot have more than 2 parameters//
var Comp c2 := Comp.create(? length (3)); //^In variable definition// //A specific value without matching symbols was expected for the first parameter of operation `create'//
var Comp c3 := Comp.create("a", *); //^In variable definition// //A specific value without matching symbols was expected for the second parameter of operation `create'//
}
type class @final @abstract C21 { } //^In type definition// //Final classes cannot be abstract//
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment