if (oldDefinition != null) {
LocalType oldType = oldDefinition.a;
if (oldType != type
|| oldType.implies(LocalType.FUNCTION)
|| type.implies(LocalType.FUNCTION)) {
s.rewriter.mq.getMessages().add(new Message(
MessageType.SYMBOL_REDEFINED,
MessageLevel.LINT,
ident.getFilePosition(),
MessagePart.Factory.valueOf(name),
oldDefinition.b));
}
}
for (Scope ancestor = s.parent; ancestor != null;
ancestor = ancestor.parent) {
Pair<LocalType, FilePosition> maskedDefinition
= ancestor.locals.get(name);
if (maskedDefinition == null) { continue; }
LocalType maskedType = maskedDefinition.a;
// Do not generate a LINT error in the case where a function masks
// itself. We recognize a self-mask when we come across a "new"
// function in the same scope as a declared function or constructor.
if (maskedType != type
&& !(maskedType == LocalType.DECLARED_FUNCTION
&& type == LocalType.FUNCTION)) {
// This used to treat masking catch variables as errors, because
// of IE<=8 behavior, but masking is unfortunately common, and
// the IE<=8 bug doesn't appears to be a security issue.
// http://code.google.com/p/google-caja/issues/detail?id=1456
if (!ident.isSynthetic() &&
ident.getFilePosition() != null) {
s.rewriter.mq.getMessages().add(new Message(
MessageType.MASKING_SYMBOL,
MessageLevel.LINT,
ident.getFilePosition(),
MessagePart.Factory.valueOf(name),
maskedDefinition.b));