bugfix for duplicate formal params
This commit is contained in:
parent
82a5535d19
commit
4be8f47351
@ -53,7 +53,7 @@ public final class IdentificationTable {
|
|||||||
// same identifier at the current level.
|
// same identifier at the current level.
|
||||||
|
|
||||||
public void enter(String id, Declaration attr) {
|
public void enter(String id, Declaration attr) {
|
||||||
attr.duplicated = retrieve(id) != null;
|
attr.duplicated = retrieve(id, true) != null;
|
||||||
this.latest = new IdEntry(id, attr, this.level, this.latest);
|
this.latest = new IdEntry(id, attr, this.level, this.latest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,9 +64,15 @@ public final class IdentificationTable {
|
|||||||
// otherwise returns the attribute field of the entry found.
|
// otherwise returns the attribute field of the entry found.
|
||||||
|
|
||||||
public Declaration retrieve(String id) {
|
public Declaration retrieve(String id) {
|
||||||
|
return retrieve(id, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// thisLevelOnly limits the search to only the current level
|
||||||
|
|
||||||
|
public Declaration retrieve(String id, boolean thisLevelOnly) {
|
||||||
var entry = this.latest;
|
var entry = this.latest;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (entry == null) {
|
if (entry == null || (thisLevelOnly && entry.level < this.level)) {
|
||||||
break;
|
break;
|
||||||
} else if (entry.id.equals(id)) {
|
} else if (entry.id.equals(id)) {
|
||||||
return entry.attr;
|
return entry.attr;
|
||||||
|
Reference in New Issue
Block a user