InlineRenamer( CodingConvention convention, Supplier<String> uniqueIdSupplier, String idPrefix, boolean removeConstness, boolean hoistingTargetScope, Renamer parent) { this.convention = convention; this.uniqueIdSupplier = uniqueIdSupplier; // To ensure that the id does not conflict with the id from the // ContextualRenamer some prefix is needed. checkArgument(!idPrefix.isEmpty()); this.idPrefix = idPrefix; this.removeConstness = removeConstness; if (hoistingTargetScope) { hoistRenamer = this; } else { hoistRenamer = parent.getHoistRenamer(); } }
InlineRenamer( CodingConvention convention, Supplier<String> uniqueIdSupplier, String idPrefix, boolean removeConstness, boolean hoistingTargetScope, Renamer parent) { this.convention = convention; this.uniqueIdSupplier = uniqueIdSupplier; // To ensure that the id does not conflict with the id from the // ContextualRenamer some prefix is needed. Preconditions.checkArgument(!idPrefix.isEmpty()); this.idPrefix = idPrefix; this.removeConstness = removeConstness; if (hoistingTargetScope) { hoistRenamer = this; } else { hoistRenamer = parent.getHoistRenamer(); } }
/** Constructor for child scopes. */ private ContextualRenamer( Node scopeRoot, Multiset<String> nameUsage, boolean hoistingTargetScope, Renamer parent) { checkState(NodeUtil.createsScope(scopeRoot), scopeRoot); if (scopeRoot.isFunction()) { checkState(!hoistingTargetScope, scopeRoot); } this.scopeRoot = scopeRoot; this.global = false; this.nameUsage = nameUsage; if (hoistingTargetScope) { checkState(!NodeUtil.createsBlockScope(scopeRoot), scopeRoot); hoistRenamer = this; } else { checkState(NodeUtil.createsBlockScope(scopeRoot) || scopeRoot.isFunction(), scopeRoot); hoistRenamer = parent.getHoistRenamer(); } }
@Override public Renamer getHoistRenamer() { return delegate.getHoistRenamer(); } }
/** * Constructor for child scopes. */ private ContextualRenamer( Multiset<String> nameUsage, boolean hoistingTargetScope, Renamer parent) { this.global = false; this.nameUsage = nameUsage; if (hoistingTargetScope) { hoistRenamer = this; } else { hoistRenamer = parent.getHoistRenamer(); } }
@Override public Renamer getHoistRenamer() { return delegate.getHoistRenamer(); } }