Skip to content

Commit

Permalink
Make a few things public so internal tools can reference them.
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147487516
  • Loading branch information
tbreisacher authored and dimvar committed Feb 15, 2017
1 parent 2ba0fc9 commit 6ac6a7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
* @author moz@google.com (Michael Zhou)
*/
class Es6SyntacticScopeCreator implements ScopeCreator {
public final class Es6SyntacticScopeCreator implements ScopeCreator {
private final AbstractCompiler compiler;
private Scope scope;
private InputId inputId;
Expand All @@ -43,7 +43,7 @@ class Es6SyntacticScopeCreator implements ScopeCreator {
// but not explicitly declared.
private static final String ARGUMENTS = "arguments";

Es6SyntacticScopeCreator(AbstractCompiler compiler) {
public Es6SyntacticScopeCreator(AbstractCompiler compiler) {
this.compiler = compiler;
this.redeclarationHandler = new DefaultRedeclarationHandler();
}
Expand Down
23 changes: 12 additions & 11 deletions src/com/google/javascript/jscomp/ReferenceCollectingCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*
* @author kushal@google.com (Kushal Dave)
*/
class ReferenceCollectingCallback implements ScopedCallback,
public final class ReferenceCollectingCallback implements ScopedCallback,
HotSwapCompilerPass,
StaticSymbolTable<Var, ReferenceCollectingCallback.Reference> {

Expand Down Expand Up @@ -90,7 +90,8 @@ class ReferenceCollectingCallback implements ScopedCallback,
/**
* Constructor initializes block stack.
*/
ReferenceCollectingCallback(AbstractCompiler compiler, Behavior behavior, ScopeCreator creator) {
public ReferenceCollectingCallback(AbstractCompiler compiler, Behavior behavior,
ScopeCreator creator) {
this(compiler, behavior, creator, Predicates.<Var>alwaysTrue());
}

Expand Down Expand Up @@ -349,7 +350,7 @@ private void addReference(Var v, Reference reference) {
referenceInfo.add(reference);
}

interface ReferenceMap {
public interface ReferenceMap {
ReferenceCollection getReferences(Var var);
}

Expand All @@ -370,7 +371,7 @@ public ReferenceCollection getReferences(Var var) {
* Way for callers to add specific behavior during traversal that
* utilizes the built-up reference information.
*/
interface Behavior {
public interface Behavior {
/**
* Called after we finish with a scope.
*/
Expand All @@ -386,7 +387,7 @@ public void afterExitScope(NodeTraversal t, ReferenceMap referenceMap) {}
* A collection of references. Can be subclassed to apply checks or
* store additional state when adding.
*/
static class ReferenceCollection implements Iterable<Reference> {
public static final class ReferenceCollection implements Iterable<Reference> {

List<Reference> references = new ArrayList<>();

Expand Down Expand Up @@ -589,7 +590,7 @@ public String toString() {
/**
* Represents a single declaration or reference to a variable.
*/
static final class Reference implements StaticRef {
public static final class Reference implements StaticRef {

private static final Set<Token> DECLARATION_PARENTS =
ImmutableSet.of(Token.VAR, Token.LET, Token.CONST, Token.PARAM_LIST,
Expand Down Expand Up @@ -695,15 +696,15 @@ private static boolean isDeclarationHelper(Node node) {
return DECLARATION_PARENTS.contains(parent.getToken());
}

boolean isVarDeclaration() {
public boolean isVarDeclaration() {
return getParent().isVar();
}

boolean isLetDeclaration() {
return getParent().isLet();
}

boolean isConstDeclaration() {
public boolean isConstDeclaration() {
return getParent().isConst();
}

Expand All @@ -714,7 +715,7 @@ boolean isHoistedFunction() {
/**
* Determines whether the variable is initialized at the declaration.
*/
boolean isInitializingDeclaration() {
public boolean isInitializingDeclaration() {
// VAR and LET are the only types of variable declarations that may not initialize
// their variables. Catch blocks, named functions, and parameters all do.
return (isDeclaration() && !getParent().isVar() && !getParent().isLet())
Expand Down Expand Up @@ -747,7 +748,7 @@ private static boolean isLhsOfEnhancedForExpression(Node n) {
return NodeUtil.isEnhancedFor(parent) && parent.getFirstChild() == n;
}

boolean isSimpleAssignmentToName() {
public boolean isSimpleAssignmentToName() {
Node parent = getParent();
return parent.isAssign()
&& parent.getFirstChild() == nameNode;
Expand All @@ -758,7 +759,7 @@ boolean isSimpleAssignmentToName() {
* TODO(tbreisacher): This method disagrees with NodeUtil#isLValue for
* "var x;" and "let x;". Consider updating it to match.
*/
boolean isLvalue() {
public boolean isLvalue() {
Node parent = getParent();
Token parentType = parent.getToken();
switch (parentType) {
Expand Down

0 comments on commit 6ac6a7e

Please sign in to comment.