Don't allow localparams to be overridden (GitHub issue #157)

Currently we only issue a warning if a parameter override references
a parameter that doesn't exist, so do the same in this case.
This commit is contained in:
Martin Whitaker 2017-06-16 20:56:31 +01:00
parent e2be64558b
commit 42422d9940
1 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2016 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2017 Stephen Williams (steve@icarus.com)
* Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch) * Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -304,16 +304,16 @@ bool NetScope::auto_name(const char*prefix, char pad, const char* suffix)
*/ */
bool NetScope::replace_parameter(perm_string key, PExpr*val, NetScope*scope) bool NetScope::replace_parameter(perm_string key, PExpr*val, NetScope*scope)
{ {
bool flag = false; if (parameters.find(key) == parameters.end())
return false;
if (parameters.find(key) != parameters.end()) {
param_expr_t&ref = parameters[key]; param_expr_t&ref = parameters[key];
if (ref.local_flag)
return false;
ref.val_expr = val; ref.val_expr = val;
ref.val_scope = scope; ref.val_scope = scope;
flag = true; return true;
}
return flag;
} }
bool NetScope::make_parameter_unannotatable(perm_string key) bool NetScope::make_parameter_unannotatable(perm_string key)