diff --git a/src/com/google/javascript/rhino/jstype/AllType.java b/src/com/google/javascript/rhino/jstype/AllType.java index 6f5a2d07e7b..fdb38ccf9bf 100644 --- a/src/com/google/javascript/rhino/jstype/AllType.java +++ b/src/com/google/javascript/rhino/jstype/AllType.java @@ -110,7 +110,7 @@ public BooleanLiteralSet getPossibleToBooleanOutcomes() { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { return this; } diff --git a/src/com/google/javascript/rhino/jstype/ArrowType.java b/src/com/google/javascript/rhino/jstype/ArrowType.java index 6b78aacec44..0ed28ed0d51 100644 --- a/src/com/google/javascript/rhino/jstype/ArrowType.java +++ b/src/com/google/javascript/rhino/jstype/ArrowType.java @@ -262,12 +262,12 @@ public BooleanLiteralSet getPossibleToBooleanOutcomes() { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { - returnType = safeResolve(returnType, t, scope); + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { + returnType = safeResolve(returnType, reporter, scope); if (parameters != null) { for (Node paramNode = parameters.getFirstChild(); paramNode != null; paramNode = paramNode.getNext()) { - paramNode.setJSType(paramNode.getJSType().resolve(t, scope)); + paramNode.setJSType(paramNode.getJSType().resolve(reporter, scope)); } } return this; diff --git a/src/com/google/javascript/rhino/jstype/EnumElementType.java b/src/com/google/javascript/rhino/jstype/EnumElementType.java index 8932846d13e..4b29a78afb9 100644 --- a/src/com/google/javascript/rhino/jstype/EnumElementType.java +++ b/src/com/google/javascript/rhino/jstype/EnumElementType.java @@ -256,8 +256,8 @@ JSType meet(JSType that) { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { - primitiveType = primitiveType.resolve(t, scope); + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { + primitiveType = primitiveType.resolve(reporter, scope); primitiveObjectType = ObjectType.cast(primitiveType); return this; } diff --git a/src/com/google/javascript/rhino/jstype/EnumType.java b/src/com/google/javascript/rhino/jstype/EnumType.java index c6f4bc7be2e..bb7a283f291 100644 --- a/src/com/google/javascript/rhino/jstype/EnumType.java +++ b/src/com/google/javascript/rhino/jstype/EnumType.java @@ -175,8 +175,8 @@ public boolean matchesObjectContext() { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { - elementsType = (EnumElementType) elementsType.resolve(t, scope); - return super.resolveInternal(t, scope); + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { + elementsType = (EnumElementType) elementsType.resolve(reporter, scope); + return super.resolveInternal(reporter, scope); } } diff --git a/src/com/google/javascript/rhino/jstype/FunctionType.java b/src/com/google/javascript/rhino/jstype/FunctionType.java index e363759e66c..83d109eca6d 100644 --- a/src/com/google/javascript/rhino/jstype/FunctionType.java +++ b/src/com/google/javascript/rhino/jstype/FunctionType.java @@ -1266,20 +1266,20 @@ public boolean hasCachedValues() { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { setResolvedTypeInternal(this); - call = (ArrowType) safeResolve(call, t, scope); + call = (ArrowType) safeResolve(call, reporter, scope); if (prototypeSlot != null) { prototypeSlot.setType( - safeResolve(prototypeSlot.getType(), t, scope)); + safeResolve(prototypeSlot.getType(), reporter, scope)); } // Warning about typeOfThis if it doesn't resolve to an ObjectType // is handled further upstream. // // TODO(nicksantos): Handle this correctly if we have a UnionType. - JSType maybeTypeOfThis = safeResolve(typeOfThis, t, scope); + JSType maybeTypeOfThis = safeResolve(typeOfThis, reporter, scope); if (maybeTypeOfThis != null) { if (maybeTypeOfThis.isNullType() || maybeTypeOfThis.isVoidType()) { typeOfThis = maybeTypeOfThis; @@ -1293,13 +1293,13 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { } ImmutableList resolvedImplemented = - resolveTypeListHelper(implementedInterfaces, t, scope); + resolveTypeListHelper(implementedInterfaces, reporter, scope); if (resolvedImplemented != null) { implementedInterfaces = resolvedImplemented; } ImmutableList resolvedExtended = - resolveTypeListHelper(extendedInterfaces, t, scope); + resolveTypeListHelper(extendedInterfaces, reporter, scope); if (resolvedExtended != null) { extendedInterfaces = resolvedExtended; } @@ -1308,11 +1308,11 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { for (int i = 0; i < subTypes.size(); i++) { FunctionType subType = (FunctionType) subTypes.get(i); subTypes.set( - i, JSType.toMaybeFunctionType(subType.resolve(t, scope))); + i, JSType.toMaybeFunctionType(subType.resolve(reporter, scope))); } } - return super.resolveInternal(t, scope); + return super.resolveInternal(reporter, scope); } /** @@ -1321,13 +1321,13 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { */ private ImmutableList resolveTypeListHelper( ImmutableList list, - ErrorReporter t, + ErrorReporter reporter, StaticTypedScope scope) { boolean changed = false; ImmutableList.Builder resolvedList = ImmutableList.builder(); for (ObjectType type : list) { - ObjectType resolved = (ObjectType) type.resolve(t, scope); + ObjectType resolved = (ObjectType) type.resolve(reporter, scope); resolvedList.add(resolved); changed |= (resolved != type); } diff --git a/src/com/google/javascript/rhino/jstype/InstanceObjectType.java b/src/com/google/javascript/rhino/jstype/InstanceObjectType.java index 7319e274fa8..07ed01a2b37 100644 --- a/src/com/google/javascript/rhino/jstype/InstanceObjectType.java +++ b/src/com/google/javascript/rhino/jstype/InstanceObjectType.java @@ -185,5 +185,5 @@ public Iterable getCtorExtendedInterfaces() { // The owner will always be a resolved type, so there's no need to set // the constructor in resolveInternal. // (it would lead to infinite loops if we did). - // JSType resolveInternal(ErrorReporter t, StaticTypedScope scope); + // JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope); } diff --git a/src/com/google/javascript/rhino/jstype/JSType.java b/src/com/google/javascript/rhino/jstype/JSType.java index 2158dc80f6a..05fa6220d72 100644 --- a/src/com/google/javascript/rhino/jstype/JSType.java +++ b/src/com/google/javascript/rhino/jstype/JSType.java @@ -1655,7 +1655,7 @@ static boolean isExemptFromTemplateTypeInvariance(JSType type) { * artifacts from a previous generation, so we will eventually need * a generational flag instead of a boolean one. */ - public final JSType resolve(ErrorReporter t, StaticTypedScope scope) { + public final JSType resolve(ErrorReporter reporter, StaticTypedScope scope) { if (resolved) { // TODO(nicksantos): Check to see if resolve() looped back on itself. // Preconditions.checkNotNull(resolveResult); @@ -1665,7 +1665,7 @@ public final JSType resolve(ErrorReporter t, StaticTypedScope scope) { return resolveResult; } resolved = true; - resolveResult = resolveInternal(t, scope); + resolveResult = resolveInternal(reporter, scope); resolveResult.setResolvedTypeInternal(resolveResult); return resolveResult; } @@ -1673,7 +1673,7 @@ public final JSType resolve(ErrorReporter t, StaticTypedScope scope) { /** * @see #resolve */ - abstract JSType resolveInternal(ErrorReporter t, StaticTypedScope scope); + abstract JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope); void setResolvedTypeInternal(JSType type) { resolveResult = type; @@ -1690,8 +1690,8 @@ public final boolean isResolved() { * @see #resolve */ static final JSType safeResolve( - JSType type, ErrorReporter t, StaticTypedScope scope) { - return type == null ? null : type.resolve(t, scope); + JSType type, ErrorReporter reporter, StaticTypedScope scope) { + return type == null ? null : type.resolve(reporter, scope); } /** diff --git a/src/com/google/javascript/rhino/jstype/NamedType.java b/src/com/google/javascript/rhino/jstype/NamedType.java index ee9bab62214..0f2829a388f 100644 --- a/src/com/google/javascript/rhino/jstype/NamedType.java +++ b/src/com/google/javascript/rhino/jstype/NamedType.java @@ -206,28 +206,28 @@ public int hashCode() { * Resolve the referenced type within the enclosing scope. */ @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope enclosing) { + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope enclosing) { // TODO(user): Investigate whether it is really necessary to keep two // different mechanisms for resolving named types, and if so, which order // makes more sense. Now, resolution via registry is first in order to // avoid triggering the warnings built into the resolution via properties. - boolean resolved = resolveViaRegistry(t); + boolean resolved = resolveViaRegistry(reporter); if (detectInheritanceCycle()) { - handleTypeCycle(t); + handleTypeCycle(reporter); } if (resolved) { - super.resolveInternal(t, enclosing); + super.resolveInternal(reporter, enclosing); finishPropertyContinuations(); return getReferencedType(); } - resolveViaProperties(t, enclosing); + resolveViaProperties(reporter, enclosing); if (detectInheritanceCycle()) { - handleTypeCycle(t); + handleTypeCycle(reporter); } - super.resolveInternal(t, enclosing); + super.resolveInternal(reporter, enclosing); if (isResolved()) { finishPropertyContinuations(); } @@ -331,37 +331,37 @@ private void setReferencedAndResolvedType( setResolvedTypeInternal(getReferencedType()); } - private void handleTypeCycle(ErrorReporter t) { + private void handleTypeCycle(ErrorReporter reporter) { setReferencedType( registry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE)); - warning(t, "Cycle detected in inheritance chain of type " + reference); + warning(reporter, "Cycle detected in inheritance chain of type " + reference); setResolvedTypeInternal(getReferencedType()); } - private void checkEnumElementCycle(ErrorReporter t) { + private void checkEnumElementCycle(ErrorReporter reporter) { JSType referencedType = getReferencedType(); if (referencedType instanceof EnumElementType && ((EnumElementType) referencedType).getPrimitiveType() == this) { - handleTypeCycle(t); + handleTypeCycle(reporter); } } - private void checkProtoCycle(ErrorReporter t) { + private void checkProtoCycle(ErrorReporter reporter) { JSType referencedType = getReferencedType(); if (referencedType == this) { - handleTypeCycle(t); + handleTypeCycle(reporter); } } // Warns about this type being unresolved iff it's not a forward-declared // type name. private void handleUnresolvedType( - ErrorReporter t, boolean ignoreForwardReferencedTypes) { + ErrorReporter reporter, boolean ignoreForwardReferencedTypes) { boolean isForwardDeclared = ignoreForwardReferencedTypes && registry.isForwardDeclaredType(reference); if (!isForwardDeclared) { String msg = "Bad type annotation. Unknown type " + reference; - warning(t, msg); + warning(reporter, msg); } else { setReferencedType(new NoResolvedType(registry, getReferenceName(), getTemplateTypes())); if (validator != null) { @@ -372,12 +372,12 @@ private void handleUnresolvedType( setResolvedTypeInternal(getReferencedType()); } - private JSType getTypedefType(ErrorReporter t, StaticTypedSlot slot) { + private JSType getTypedefType(ErrorReporter reporter, StaticTypedSlot slot) { JSType type = slot.getType(); if (type != null) { return type; } - handleUnresolvedType(t, true); + handleUnresolvedType(reporter, true); return null; } diff --git a/src/com/google/javascript/rhino/jstype/NamespaceType.java b/src/com/google/javascript/rhino/jstype/NamespaceType.java index 98652897502..d37e5371d02 100644 --- a/src/com/google/javascript/rhino/jstype/NamespaceType.java +++ b/src/com/google/javascript/rhino/jstype/NamespaceType.java @@ -75,8 +75,8 @@ class NamespaceType extends NamedType { * Resolve the referenced type within the enclosing scope. */ @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope enclosing) { - warning(t, "Namespaces not supported yet (" + getReferenceName() + ")"); + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope enclosing) { + warning(reporter, "Namespaces not supported yet (" + getReferenceName() + ")"); return registry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE); } } diff --git a/src/com/google/javascript/rhino/jstype/NoObjectType.java b/src/com/google/javascript/rhino/jstype/NoObjectType.java index 6782201aeaa..02588c4edac 100644 --- a/src/com/google/javascript/rhino/jstype/NoObjectType.java +++ b/src/com/google/javascript/rhino/jstype/NoObjectType.java @@ -185,7 +185,7 @@ public FunctionType getConstructor() { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { return this; } } diff --git a/src/com/google/javascript/rhino/jstype/PrototypeObjectType.java b/src/com/google/javascript/rhino/jstype/PrototypeObjectType.java index 1c19c007a7e..578898d1307 100644 --- a/src/com/google/javascript/rhino/jstype/PrototypeObjectType.java +++ b/src/com/google/javascript/rhino/jstype/PrototypeObjectType.java @@ -496,13 +496,13 @@ public Iterable getCtorExtendedInterfaces() { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { setResolvedTypeInternal(this); ObjectType implicitPrototype = getImplicitPrototype(); if (implicitPrototype != null) { implicitPrototypeFallback = - (ObjectType) implicitPrototype.resolve(t, scope); + (ObjectType) implicitPrototype.resolve(reporter, scope); FunctionType ctor = getConstructor(); if (ctor != null) { FunctionType superCtor = ctor.getSuperClassConstructor(); @@ -514,7 +514,7 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { } } for (Property prop : properties.values()) { - prop.setType(safeResolve(prop.getType(), t, scope)); + prop.setType(safeResolve(prop.getType(), reporter, scope)); } return this; } diff --git a/src/com/google/javascript/rhino/jstype/ProxyObjectType.java b/src/com/google/javascript/rhino/jstype/ProxyObjectType.java index 0bb5b59f0b2..ab0ea03f320 100644 --- a/src/com/google/javascript/rhino/jstype/ProxyObjectType.java +++ b/src/com/google/javascript/rhino/jstype/ProxyObjectType.java @@ -367,8 +367,8 @@ public T visit(Visitor visitor) { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { - setReferencedType(referencedType.resolve(t, scope)); + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { + setReferencedType(referencedType.resolve(reporter, scope)); return this; } diff --git a/src/com/google/javascript/rhino/jstype/UnionType.java b/src/com/google/javascript/rhino/jstype/UnionType.java index 460e3aed2f6..79d8f7e4af5 100644 --- a/src/com/google/javascript/rhino/jstype/UnionType.java +++ b/src/com/google/javascript/rhino/jstype/UnionType.java @@ -709,12 +709,12 @@ public T visit(Visitor visitor) { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { setResolvedTypeInternal(this); // for circularly defined types. for (int i = 0; i < alternatesWithoutStucturalTyping.size(); i++) { JSType alternate = alternatesWithoutStucturalTyping.get(i); - alternate.resolve(t, scope); + alternate.resolve(reporter, scope); } // Ensure the union is in a normalized state. rebuildAlternates(); diff --git a/src/com/google/javascript/rhino/jstype/UnknownType.java b/src/com/google/javascript/rhino/jstype/UnknownType.java index 8176d9039c1..c082e0f3089 100644 --- a/src/com/google/javascript/rhino/jstype/UnknownType.java +++ b/src/com/google/javascript/rhino/jstype/UnknownType.java @@ -171,7 +171,7 @@ public BooleanLiteralSet getPossibleToBooleanOutcomes() { } @Override - JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { + JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { return this; } diff --git a/src/com/google/javascript/rhino/jstype/ValueType.java b/src/com/google/javascript/rhino/jstype/ValueType.java index 270aefa8c67..8e1724e4012 100644 --- a/src/com/google/javascript/rhino/jstype/ValueType.java +++ b/src/com/google/javascript/rhino/jstype/ValueType.java @@ -50,7 +50,7 @@ abstract class ValueType extends JSType { } @Override - final JSType resolveInternal(ErrorReporter t, StaticTypedScope scope) { + final JSType resolveInternal(ErrorReporter reporter, StaticTypedScope scope) { return this; } diff --git a/src/com/google/javascript/rhino/testing/Asserts.java b/src/com/google/javascript/rhino/testing/Asserts.java index 6cc37bcc430..8c2c377c0e4 100644 --- a/src/com/google/javascript/rhino/testing/Asserts.java +++ b/src/com/google/javascript/rhino/testing/Asserts.java @@ -68,8 +68,8 @@ public static JSType assertValidResolve(JSType type) { /** @return The resolved type */ public static JSType assertValidResolve(JSType type, StaticTypedScope scope) { - ErrorReporter t = TestErrorReporter.forNoExpectedReports(); - JSType resolvedType = type.resolve(t, scope); + ErrorReporter reporter = TestErrorReporter.forNoExpectedReports(); + JSType resolvedType = type.resolve(reporter, scope); assertTypeEquals("JSType#resolve should not affect object equality", type, resolvedType); return resolvedType; }