Make sure symbol table doesn't cry on duplicate name

This commit is contained in:
Clément Fournier
2020-02-09 00:11:06 +01:00
parent ad023e8fa6
commit 5a6d332579

View File

@ -24,9 +24,13 @@ public abstract class AbstractJavaScope extends AbstractScope {
} }
protected void checkForDuplicatedNameDeclaration(NameDeclaration declaration) { protected void checkForDuplicatedNameDeclaration(NameDeclaration declaration) {
if (declaration instanceof VariableNameDeclaration && getDeclarations().keySet().contains(declaration)) { // Don't throw an exception, type tests patterns are tricky to implement
throw new RuntimeException(declaration + " is already in the symbol table"); // and given it's a preview feature, and the sym table will be replaced
} // for 7.0, it's not useful to support them.
// if (declaration instanceof VariableNameDeclaration && getDeclarations().keySet().contains(declaration)) {
// throw new RuntimeException(declaration + " is already in the symbol table");
// }
} }
@Override @Override