Warn that classes defined in the compilation unit scope are not supported

This commit is contained in:
Cary R 2014-09-08 16:52:20 -07:00
parent 1572dcd3fd
commit ec2793c9b0
2 changed files with 13 additions and 1 deletions

View File

@ -1589,6 +1589,7 @@ package_item /* IEEE1800-2005 A.1.10 */
| function_declaration
| task_declaration
| data_declaration
| class_declaration
;
package_item_list

View File

@ -328,6 +328,17 @@ PClass* pform_push_class_scope(const struct vlltype&loc, perm_string name)
assert(!pform_cur_generate);
/* If no scope was found then this is being defined in the
* compilation unit scope. */
if (scopex == 0) {
cerr << class_scope->get_fileline() << ": sorry: class "
"declarations in the compilation unit scope are not yet "
"supported." << endl;
error_count += 1;
lexical_scope = class_scope;
return class_scope;
}
if (scopex->classes.find(name) != scopex->classes.end()) {
cerr << class_scope->get_fileline() << ": error: duplicate "
"definition for class '" << name << "' in '"