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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return this; 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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
returnType = safeResolve(returnType, t, scope); returnType = safeResolve(returnType, reporter, scope);
if (parameters != null) { if (parameters != null) {
for (Node paramNode = parameters.getFirstChild(); for (Node paramNode = parameters.getFirstChild();
paramNode != null; paramNode = paramNode.getNext()) { paramNode != null; paramNode = paramNode.getNext()) {
paramNode.setJSType(paramNode.getJSType().resolve(t, scope)); paramNode.setJSType(paramNode.getJSType().resolve(reporter, scope));
} }
} }
return this; 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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
primitiveType = primitiveType.resolve(t, scope); primitiveType = primitiveType.resolve(reporter, scope);
primitiveObjectType = ObjectType.cast(primitiveType); primitiveObjectType = ObjectType.cast(primitiveType);
return this; 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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
elementsType = (EnumElementType) elementsType.resolve(t, scope); elementsType = (EnumElementType) elementsType.resolve(reporter, scope);
return super.resolveInternal(t, 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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
setResolvedTypeInternal(this); setResolvedTypeInternal(this);


call = (ArrowType) safeResolve(call, t, scope); call = (ArrowType) safeResolve(call, reporter, scope);
if (prototypeSlot != null) { if (prototypeSlot != null) {
prototypeSlot.setType( prototypeSlot.setType(
safeResolve(prototypeSlot.getType(), t, scope)); safeResolve(prototypeSlot.getType(), reporter, scope));
} }


// Warning about typeOfThis if it doesn't resolve to an ObjectType // Warning about typeOfThis if it doesn't resolve to an ObjectType
// is handled further upstream. // is handled further upstream.
// //
// TODO(nicksantos): Handle this correctly if we have a UnionType. // 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 != null) {
if (maybeTypeOfThis.isNullType() || maybeTypeOfThis.isVoidType()) { if (maybeTypeOfThis.isNullType() || maybeTypeOfThis.isVoidType()) {
typeOfThis = maybeTypeOfThis; typeOfThis = maybeTypeOfThis;
Expand All @@ -1293,13 +1293,13 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
} }


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


ImmutableList<ObjectType> resolvedExtended = ImmutableList<ObjectType> resolvedExtended =
resolveTypeListHelper(extendedInterfaces, t, scope); resolveTypeListHelper(extendedInterfaces, reporter, scope);
if (resolvedExtended != null) { if (resolvedExtended != null) {
extendedInterfaces = resolvedExtended; extendedInterfaces = resolvedExtended;
} }
Expand All @@ -1308,11 +1308,11 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
for (int i = 0; i < subTypes.size(); i++) { for (int i = 0; i < subTypes.size(); i++) {
FunctionType subType = (FunctionType) subTypes.get(i); FunctionType subType = (FunctionType) subTypes.get(i);
subTypes.set( 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( private ImmutableList<ObjectType> resolveTypeListHelper(
ImmutableList<ObjectType> list, ImmutableList<ObjectType> list,
ErrorReporter t, ErrorReporter reporter,
StaticTypedScope<JSType> scope) { StaticTypedScope<JSType> scope) {
boolean changed = false; boolean changed = false;
ImmutableList.Builder<ObjectType> resolvedList = ImmutableList.Builder<ObjectType> resolvedList =
ImmutableList.builder(); ImmutableList.builder();
for (ObjectType type : list) { for (ObjectType type : list) {
ObjectType resolved = (ObjectType) type.resolve(t, scope); ObjectType resolved = (ObjectType) type.resolve(reporter, scope);
resolvedList.add(resolved); resolvedList.add(resolved);
changed |= (resolved != type); 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 owner will always be a resolved type, so there's no need to set
// the constructor in resolveInternal. // the constructor in resolveInternal.
// (it would lead to infinite loops if we did). // (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 * artifacts from a previous generation, so we will eventually need
* a generational flag instead of a boolean one. * 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) { if (resolved) {
// TODO(nicksantos): Check to see if resolve() looped back on itself. // TODO(nicksantos): Check to see if resolve() looped back on itself.
// Preconditions.checkNotNull(resolveResult); // Preconditions.checkNotNull(resolveResult);
Expand All @@ -1665,15 +1665,15 @@ public final JSType resolve(ErrorReporter t, StaticTypedScope<JSType> scope) {
return resolveResult; return resolveResult;
} }
resolved = true; resolved = true;
resolveResult = resolveInternal(t, scope); resolveResult = resolveInternal(reporter, scope);
resolveResult.setResolvedTypeInternal(resolveResult); resolveResult.setResolvedTypeInternal(resolveResult);
return resolveResult; return resolveResult;
} }


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


void setResolvedTypeInternal(JSType type) { void setResolvedTypeInternal(JSType type) {
resolveResult = type; resolveResult = type;
Expand All @@ -1690,8 +1690,8 @@ public final boolean isResolved() {
* @see #resolve * @see #resolve
*/ */
static final JSType safeResolve( static final JSType safeResolve(
JSType type, ErrorReporter t, StaticTypedScope<JSType> scope) { JSType type, ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return type == null ? null : type.resolve(t, 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. * Resolve the referenced type within the enclosing scope.
*/ */
@Override @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 // TODO(user): Investigate whether it is really necessary to keep two
// different mechanisms for resolving named types, and if so, which order // different mechanisms for resolving named types, and if so, which order
// makes more sense. Now, resolution via registry is first in order to // makes more sense. Now, resolution via registry is first in order to
// avoid triggering the warnings built into the resolution via properties. // avoid triggering the warnings built into the resolution via properties.
boolean resolved = resolveViaRegistry(t); boolean resolved = resolveViaRegistry(reporter);
if (detectInheritanceCycle()) { if (detectInheritanceCycle()) {
handleTypeCycle(t); handleTypeCycle(reporter);
} }


if (resolved) { if (resolved) {
super.resolveInternal(t, enclosing); super.resolveInternal(reporter, enclosing);
finishPropertyContinuations(); finishPropertyContinuations();
return getReferencedType(); return getReferencedType();
} }


resolveViaProperties(t, enclosing); resolveViaProperties(reporter, enclosing);
if (detectInheritanceCycle()) { if (detectInheritanceCycle()) {
handleTypeCycle(t); handleTypeCycle(reporter);
} }


super.resolveInternal(t, enclosing); super.resolveInternal(reporter, enclosing);
if (isResolved()) { if (isResolved()) {
finishPropertyContinuations(); finishPropertyContinuations();
} }
Expand Down Expand Up @@ -331,37 +331,37 @@ private void setReferencedAndResolvedType(
setResolvedTypeInternal(getReferencedType()); setResolvedTypeInternal(getReferencedType());
} }


private void handleTypeCycle(ErrorReporter t) { private void handleTypeCycle(ErrorReporter reporter) {
setReferencedType( setReferencedType(
registry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE)); 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()); setResolvedTypeInternal(getReferencedType());
} }


private void checkEnumElementCycle(ErrorReporter t) { private void checkEnumElementCycle(ErrorReporter reporter) {
JSType referencedType = getReferencedType(); JSType referencedType = getReferencedType();
if (referencedType instanceof EnumElementType && if (referencedType instanceof EnumElementType &&
((EnumElementType) referencedType).getPrimitiveType() == this) { ((EnumElementType) referencedType).getPrimitiveType() == this) {
handleTypeCycle(t); handleTypeCycle(reporter);
} }
} }


private void checkProtoCycle(ErrorReporter t) { private void checkProtoCycle(ErrorReporter reporter) {
JSType referencedType = getReferencedType(); JSType referencedType = getReferencedType();
if (referencedType == this) { if (referencedType == this) {
handleTypeCycle(t); handleTypeCycle(reporter);
} }
} }


// Warns about this type being unresolved iff it's not a forward-declared // Warns about this type being unresolved iff it's not a forward-declared
// type name. // type name.
private void handleUnresolvedType( private void handleUnresolvedType(
ErrorReporter t, boolean ignoreForwardReferencedTypes) { ErrorReporter reporter, boolean ignoreForwardReferencedTypes) {
boolean isForwardDeclared = boolean isForwardDeclared =
ignoreForwardReferencedTypes && registry.isForwardDeclaredType(reference); ignoreForwardReferencedTypes && registry.isForwardDeclaredType(reference);
if (!isForwardDeclared) { if (!isForwardDeclared) {
String msg = "Bad type annotation. Unknown type " + reference; String msg = "Bad type annotation. Unknown type " + reference;
warning(t, msg); warning(reporter, msg);
} else { } else {
setReferencedType(new NoResolvedType(registry, getReferenceName(), getTemplateTypes())); setReferencedType(new NoResolvedType(registry, getReferenceName(), getTemplateTypes()));
if (validator != null) { if (validator != null) {
Expand All @@ -372,12 +372,12 @@ private void handleUnresolvedType(
setResolvedTypeInternal(getReferencedType()); setResolvedTypeInternal(getReferencedType());
} }


private JSType getTypedefType(ErrorReporter t, StaticTypedSlot<JSType> slot) { private JSType getTypedefType(ErrorReporter reporter, StaticTypedSlot<JSType> slot) {
JSType type = slot.getType(); JSType type = slot.getType();
if (type != null) { if (type != null) {
return type; return type;
} }
handleUnresolvedType(t, true); handleUnresolvedType(reporter, true);
return null; 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. * Resolve the referenced type within the enclosing scope.
*/ */
@Override @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> enclosing) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> enclosing) {
warning(t, "Namespaces not supported yet (" + getReferenceName() + ")"); warning(reporter, "Namespaces not supported yet (" + getReferenceName() + ")");
return registry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE); 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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return this; return this;
} }
} }
Expand Up @@ -496,13 +496,13 @@ public Iterable<ObjectType> getCtorExtendedInterfaces() {
} }


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


ObjectType implicitPrototype = getImplicitPrototype(); ObjectType implicitPrototype = getImplicitPrototype();
if (implicitPrototype != null) { if (implicitPrototype != null) {
implicitPrototypeFallback = implicitPrototypeFallback =
(ObjectType) implicitPrototype.resolve(t, scope); (ObjectType) implicitPrototype.resolve(reporter, scope);
FunctionType ctor = getConstructor(); FunctionType ctor = getConstructor();
if (ctor != null) { if (ctor != null) {
FunctionType superCtor = ctor.getSuperClassConstructor(); FunctionType superCtor = ctor.getSuperClassConstructor();
Expand All @@ -514,7 +514,7 @@ JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) {
} }
} }
for (Property prop : properties.values()) { for (Property prop : properties.values()) {
prop.setType(safeResolve(prop.getType(), t, scope)); prop.setType(safeResolve(prop.getType(), reporter, scope));
} }
return this; 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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
setReferencedType(referencedType.resolve(t, scope)); setReferencedType(referencedType.resolve(reporter, scope));
return this; 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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
setResolvedTypeInternal(this); // for circularly defined types. setResolvedTypeInternal(this); // for circularly defined types.


for (int i = 0; i < alternatesWithoutStucturalTyping.size(); i++) { for (int i = 0; i < alternatesWithoutStucturalTyping.size(); i++) {
JSType alternate = alternatesWithoutStucturalTyping.get(i); JSType alternate = alternatesWithoutStucturalTyping.get(i);
alternate.resolve(t, scope); alternate.resolve(reporter, scope);
} }
// Ensure the union is in a normalized state. // Ensure the union is in a normalized state.
rebuildAlternates(); 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 @Override
JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return this; 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 @Override
final JSType resolveInternal(ErrorReporter t, StaticTypedScope<JSType> scope) { final JSType resolveInternal(ErrorReporter reporter, StaticTypedScope<JSType> scope) {
return this; 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 */ /** @return The resolved type */
public static JSType assertValidResolve(JSType type, StaticTypedScope<JSType> scope) { public static JSType assertValidResolve(JSType type, StaticTypedScope<JSType> scope) {
ErrorReporter t = TestErrorReporter.forNoExpectedReports(); ErrorReporter reporter = TestErrorReporter.forNoExpectedReports();
JSType resolvedType = type.resolve(t, scope); JSType resolvedType = type.resolve(reporter, scope);
assertTypeEquals("JSType#resolve should not affect object equality", type, resolvedType); assertTypeEquals("JSType#resolve should not affect object equality", type, resolvedType);
return resolvedType; return resolvedType;
} }
Expand Down

0 comments on commit ab8c0ff

Please sign in to comment.