Skip to content

Commit

Permalink
Rename ErrorReport locals where "t" was used. This isn't a convention…
Browse files Browse the repository at this point in the history
… we are using (Unlike 'n' for the current Node).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189108468
  • Loading branch information
concavelenz authored and blickly committed Mar 15, 2018
1 parent 6a90643 commit ab8c0ff
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/com/google/javascript/rhino/jstype/AllType.java
Expand Up @@ -110,7 +110,7 @@ public BooleanLiteralSet getPossibleToBooleanOutcomes() {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return this;
}

Expand Down
6 changes: 3 additions & 3 deletions src/com/google/javascript/rhino/jstype/ArrowType.java
Expand Up @@ -262,12 +262,12 @@ public BooleanLiteralSet getPossibleToBooleanOutcomes() {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
returnType = safeResolve(returnType, t, scope);
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> 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;
Expand Down
4 changes: 2 additions & 2 deletions src/com/google/javascript/rhino/jstype/EnumElementType.java
Expand Up @@ -256,8 +256,8 @@ JSType meet(JSType that) {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
primitiveType = primitiveType.resolve(t, scope);
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
primitiveType = primitiveType.resolve(reporter, scope);
primitiveObjectType = ObjectType.cast(primitiveType);
return this;
}
Expand Down
6 changes: 3 additions & 3 deletions src/com/google/javascript/rhino/jstype/EnumType.java
Expand Up @@ -175,8 +175,8 @@ public boolean matchesObjectContext() {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
elementsType = (EnumElementType) elementsType.resolve(t, scope);
return super.resolveInternal(t, scope);
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
elementsType = (EnumElementType) elementsType.resolve(reporter, scope);
return super.resolveInternal(reporter, scope);
}
}
20 changes: 10 additions & 10 deletions src/com/google/javascript/rhino/jstype/FunctionType.java
Expand Up @@ -1266,20 +1266,20 @@ public boolean hasCachedValues() {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> 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;
Expand All @@ -1293,13 +1293,13 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
}

ImmutableList<ObjectType> resolvedImplemented =
resolveTypeListHelper(implementedInterfaces, t, scope);
resolveTypeListHelper(implementedInterfaces, reporter, scope);
if (resolvedImplemented != null) {
implementedInterfaces = resolvedImplemented;
}

ImmutableList<ObjectType> resolvedExtended =
resolveTypeListHelper(extendedInterfaces, t, scope);
resolveTypeListHelper(extendedInterfaces, reporter, scope);
if (resolvedExtended != null) {
extendedInterfaces = resolvedExtended;
}
Expand All @@ -1308,11 +1308,11 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> 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);
}

/**
Expand All @@ -1321,13 +1321,13 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
*/
private ImmutableList<ObjectType> resolveTypeListHelper(
ImmutableList<ObjectType> list,
ErrorReporter t,
ErrorReporter reporter,
StaticTypedScope<JSType> scope) {
boolean changed = false;
ImmutableList.Builder<ObjectType> 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);
}
Expand Down
Expand Up @@ -185,5 +185,5 @@ public Iterable<ObjectType> 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<JSType> scope);
// JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope);
}
10 changes: 5 additions & 5 deletions src/com/google/javascript/rhino/jstype/JSType.java
Expand Up @@ -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<JSType> scope) {
public final JSType resolve(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
if (resolved) {
// TODO(nicksantos): Check to see if resolve() looped back on itself.
// Preconditions.checkNotNull(resolveResult);
Expand All @@ -1665,15 +1665,15 @@ public final JSType resolve(ErrorReporter t, StaticTypedScope<JSType> scope) {
return resolveResult;
}
resolved = true;
resolveResult = resolveInternal(t, scope);
resolveResult = resolveInternal(reporter, scope);
resolveResult.setResolvedTypeInternal(resolveResult);
return resolveResult;
}

/**
* @see #resolve
*/
abstract JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope);
abstract JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope);

void setResolvedTypeInternal(JSType type) {
resolveResult = type;
Expand All @@ -1690,8 +1690,8 @@ public final boolean isResolved() {
* @see #resolve
*/
static final JSType safeResolve(
JSType type, ErrorReporter t, StaticTypedScope<JSType> scope) {
return type == null ? null : type.resolve(t, scope);
JSType type, ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return type == null ? null : type.resolve(reporter, scope);
}

/**
Expand Down
34 changes: 17 additions & 17 deletions src/com/google/javascript/rhino/jstype/NamedType.java
Expand Up @@ -206,28 +206,28 @@ public int hashCode() {
* Resolve the referenced type within the enclosing scope.
*/
@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> enclosing) {
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> 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();
}
Expand Down Expand Up @@ -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) {
Expand All @@ -372,12 +372,12 @@ private void handleUnresolvedType(
setResolvedTypeInternal(getReferencedType());
}

private JSType getTypedefType(ErrorReporter t, StaticTypedSlot<JSType> slot) {
private JSType getTypedefType(ErrorReporter reporter, StaticTypedSlot<JSType> slot) {
JSType type = slot.getType();
if (type != null) {
return type;
}
handleUnresolvedType(t, true);
handleUnresolvedType(reporter, true);
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/com/google/javascript/rhino/jstype/NamespaceType.java
Expand Up @@ -75,8 +75,8 @@ class NamespaceType extends NamedType {
* Resolve the referenced type within the enclosing scope.
*/
@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> enclosing) {
warning(t, "Namespaces not supported yet (" + getReferenceName() + ")");
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> enclosing) {
warning(reporter, "Namespaces not supported yet (" + getReferenceName() + ")");
return registry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE);
}
}
2 changes: 1 addition & 1 deletion src/com/google/javascript/rhino/jstype/NoObjectType.java
Expand Up @@ -185,7 +185,7 @@ public FunctionType getConstructor() {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return this;
}
}
Expand Up @@ -496,13 +496,13 @@ public Iterable<ObjectType> getCtorExtendedInterfaces() {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> 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();
Expand All @@ -514,7 +514,7 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
}
}
for (Property prop : properties.values()) {
prop.setType(safeResolve(prop.getType(), t, scope));
prop.setType(safeResolve(prop.getType(), reporter, scope));
}
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/com/google/javascript/rhino/jstype/ProxyObjectType.java
Expand Up @@ -367,8 +367,8 @@ public <T> T visit(Visitor<T> visitor) {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
setReferencedType(referencedType.resolve(t, scope));
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
setReferencedType(referencedType.resolve(reporter, scope));
return this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/com/google/javascript/rhino/jstype/UnionType.java
Expand Up @@ -709,12 +709,12 @@ public <T> T visit(Visitor<T> visitor) {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> 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();
Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/rhino/jstype/UnknownType.java
Expand Up @@ -171,7 +171,7 @@ public BooleanLiteralSet getPossibleToBooleanOutcomes() {
}

@Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/rhino/jstype/ValueType.java
Expand Up @@ -50,7 +50,7 @@ abstract class ValueType extends JSType {
}

@Override
final JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
final JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/com/google/javascript/rhino/testing/Asserts.java
Expand Up @@ -68,8 +68,8 @@ public static JSType assertValidResolve(JSType type) {

/** @return The resolved type */
public static JSType assertValidResolve(JSType type, StaticTypedScope<JSType> 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;
}
Expand Down

0 comments on commit ab8c0ff

Please sign in to comment.