Commit 89314801 authored by Zhi An Ng's avatar Zhi An Ng Committed by Commit Bot

[cleanup][parsing] Remove uses of DISALLOW_COPY_AND_ASSIGN

Bug: v8:11074
Change-Id: I01ffd94290aa5deafa0953a86ff555147b813bf4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2557069Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71389}
parent fc61c38a
......@@ -43,6 +43,9 @@ class VariableProxy;
template <typename Types>
class ExpressionScope {
public:
ExpressionScope(const ExpressionScope&) = delete;
ExpressionScope& operator=(const ExpressionScope&) = delete;
using ParserT = typename Types::Impl;
using ExpressionT = typename Types::Expression;
......@@ -342,8 +345,6 @@ class ExpressionScope {
ScopeType type_;
bool has_possible_parameter_in_scope_chain_;
bool has_possible_arrow_parameter_in_scope_chain_;
DISALLOW_COPY_AND_ASSIGN(ExpressionScope);
};
// Used to unambiguously parse var, let, const declarations.
......@@ -362,6 +363,11 @@ class VariableDeclarationParsingScope : public ExpressionScope<Types> {
mode_(mode),
names_(names) {}
VariableDeclarationParsingScope(const VariableDeclarationParsingScope&) =
delete;
VariableDeclarationParsingScope& operator=(
const VariableDeclarationParsingScope&) = delete;
Variable* Declare(const AstRawString* name, int pos) {
VariableKind kind = NORMAL_VARIABLE;
bool was_added;
......@@ -413,8 +419,6 @@ class VariableDeclarationParsingScope : public ExpressionScope<Types> {
VariableMode mode_;
ZonePtrList<const AstRawString>* names_;
DISALLOW_COPY_AND_ASSIGN(VariableDeclarationParsingScope);
};
template <typename Types>
......@@ -427,6 +431,11 @@ class ParameterDeclarationParsingScope : public ExpressionScope<Types> {
explicit ParameterDeclarationParsingScope(ParserT* parser)
: ExpressionScopeT(parser, ExpressionScopeT::kParameterDeclaration) {}
ParameterDeclarationParsingScope(const ParameterDeclarationParsingScope&) =
delete;
ParameterDeclarationParsingScope& operator=(
const ParameterDeclarationParsingScope&) = delete;
Variable* Declare(const AstRawString* name, int pos) {
VariableKind kind = PARAMETER_VARIABLE;
VariableMode mode = VariableMode::kVar;
......@@ -446,7 +455,6 @@ class ParameterDeclarationParsingScope : public ExpressionScope<Types> {
private:
Scanner::Location duplicate_loc_ = Scanner::Location::invalid();
DISALLOW_COPY_AND_ASSIGN(ParameterDeclarationParsingScope);
};
// Parsing expressions is always ambiguous between at least left-hand-side and
......@@ -480,6 +488,9 @@ class ExpressionParsingScope : public ExpressionScope<Types> {
clear(kPatternIndex);
}
ExpressionParsingScope(const ExpressionParsingScope&) = delete;
ExpressionParsingScope& operator=(const ExpressionParsingScope&) = delete;
void RecordAsyncArrowParametersError(const Scanner::Location& loc,
MessageTemplate message) {
for (ExpressionScopeT* scope = this; scope != nullptr;
......@@ -643,8 +654,6 @@ class ExpressionParsingScope : public ExpressionScope<Types> {
MessageTemplate messages_[kNumberOfErrors];
Scanner::Location locations_[kNumberOfErrors];
bool has_async_arrow_in_scope_chain_;
DISALLOW_COPY_AND_ASSIGN(ExpressionParsingScope);
};
// This class is used to parse multiple ambiguous expressions and declarations
......@@ -672,6 +681,9 @@ class AccumulationScope {
}
}
AccumulationScope(const AccumulationScope&) = delete;
AccumulationScope& operator=(const AccumulationScope&) = delete;
// Merge errors from the underlying ExpressionParsingScope into this scope.
// Only keeps the first error across all accumulate calls, and removes the
// error from the underlying scope.
......@@ -723,8 +735,6 @@ class AccumulationScope {
ExpressionParsingScope<Types>* scope_;
MessageTemplate messages_[2];
Scanner::Location locations_[2];
DISALLOW_COPY_AND_ASSIGN(AccumulationScope);
};
// The head of an arrow function is ambiguous between expression, assignment
......@@ -750,6 +760,9 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> {
DCHECK(!this->IsCertainlyDeclaration());
}
ArrowHeadParsingScope(const ArrowHeadParsingScope&) = delete;
ArrowHeadParsingScope& operator=(const ArrowHeadParsingScope&) = delete;
void ValidateExpression() {
// Turns out this is not an arrow head. Clear any possible tracked strict
// parameter errors, and reinterpret tracked variables as unresolved
......@@ -822,8 +835,6 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> {
MessageTemplate declaration_error_message = MessageTemplate::kNone;
bool has_simple_parameter_list_ = true;
bool uses_this_ = false;
DISALLOW_COPY_AND_ASSIGN(ArrowHeadParsingScope);
};
} // namespace internal
......
......@@ -39,6 +39,9 @@ class FuncNameInferrer {
public:
explicit FuncNameInferrer(AstValueFactory* ast_value_factory);
FuncNameInferrer(const FuncNameInferrer&) = delete;
FuncNameInferrer& operator=(const FuncNameInferrer&) = delete;
// To enter function name inference state, put a FuncNameInferrer::State
// on the stack.
class State {
......@@ -52,12 +55,12 @@ class FuncNameInferrer {
fni_->names_stack_.resize(top_);
--fni_->scope_depth_;
}
State(const State&) = delete;
State& operator=(const State&) = delete;
private:
FuncNameInferrer* fni_;
size_t top_;
DISALLOW_COPY_AND_ASSIGN(State);
};
// Returns whether we have entered name collection state.
......@@ -119,8 +122,6 @@ class FuncNameInferrer {
std::vector<Name> names_stack_;
std::vector<FunctionLiteral*> funcs_to_infer_;
size_t scope_depth_ = 0;
DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer);
};
......
......@@ -18,6 +18,9 @@ class LiteralBuffer final {
~LiteralBuffer() { backing_store_.Dispose(); }
LiteralBuffer(const LiteralBuffer&) = delete;
LiteralBuffer& operator=(const LiteralBuffer&) = delete;
V8_INLINE void AddChar(char code_unit) {
DCHECK(IsValidAscii(code_unit));
AddOneByteChar(static_cast<byte>(code_unit));
......@@ -95,8 +98,6 @@ class LiteralBuffer final {
int position_;
bool is_one_byte_;
DISALLOW_COPY_AND_ASSIGN(LiteralBuffer);
};
} // namespace internal
......
......@@ -28,6 +28,11 @@ class PendingCompilationErrorHandler {
PendingCompilationErrorHandler()
: has_pending_error_(false), stack_overflow_(false) {}
PendingCompilationErrorHandler(const PendingCompilationErrorHandler&) =
delete;
PendingCompilationErrorHandler& operator=(
const PendingCompilationErrorHandler&) = delete;
void ReportMessageAt(int start_position, int end_position,
MessageTemplate message, const char* arg = nullptr);
......@@ -130,8 +135,6 @@ class PendingCompilationErrorHandler {
MessageDetails error_details_;
std::forward_list<MessageDetails> warning_messages_;
DISALLOW_COPY_AND_ASSIGN(PendingCompilationErrorHandler);
};
extern template void PendingCompilationErrorHandler::PrepareErrors(
......
......@@ -144,6 +144,8 @@ class BaseConsumedPreparseData : public ConsumedPreparseData {
};
BaseConsumedPreparseData() : scope_data_(new ByteData()), child_index_(0) {}
BaseConsumedPreparseData(const BaseConsumedPreparseData&) = delete;
BaseConsumedPreparseData& operator=(const BaseConsumedPreparseData&) = delete;
virtual Data GetScopeData() = 0;
......@@ -174,8 +176,6 @@ class BaseConsumedPreparseData : public ConsumedPreparseData {
// When consuming the data, these indexes point to the data we're going to
// consume next.
int child_index_;
DISALLOW_COPY_AND_ASSIGN(BaseConsumedPreparseData);
};
// Implementation of ConsumedPreparseData for on-heap data.
......@@ -198,6 +198,9 @@ class ZonePreparseData : public ZoneObject {
V8_EXPORT_PRIVATE ZonePreparseData(Zone* zone, Vector<uint8_t>* byte_data,
int child_length);
ZonePreparseData(const ZonePreparseData&) = delete;
ZonePreparseData& operator=(const ZonePreparseData&) = delete;
Handle<PreparseData> Serialize(Isolate* isolate);
Handle<PreparseData> Serialize(LocalIsolate* isolate);
......@@ -215,8 +218,6 @@ class ZonePreparseData : public ZoneObject {
private:
ZoneVector<uint8_t> byte_data_;
ZoneVector<ZonePreparseData*> children_;
DISALLOW_COPY_AND_ASSIGN(ZonePreparseData);
};
ZonePreparseData* PreparseDataBuilder::ByteData::CopyToZone(
......
......@@ -101,6 +101,8 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject,
explicit PreparseDataBuilder(Zone* zone, PreparseDataBuilder* parent_builder,
std::vector<void*>* children_buffer);
~PreparseDataBuilder() {}
PreparseDataBuilder(const PreparseDataBuilder&) = delete;
PreparseDataBuilder& operator=(const PreparseDataBuilder&) = delete;
PreparseDataBuilder* parent() const { return parent_; }
......@@ -111,6 +113,8 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject,
public:
explicit DataGatheringScope(PreParser* preparser)
: preparser_(preparser), builder_(nullptr) {}
DataGatheringScope(const DataGatheringScope&) = delete;
DataGatheringScope& operator=(const DataGatheringScope&) = delete;
void Start(DeclarationScope* function_scope);
void SetSkippableFunction(DeclarationScope* function_scope,
......@@ -125,8 +129,6 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject,
PreParser* preparser_;
PreparseDataBuilder* builder_;
DISALLOW_COPY_AND_ASSIGN(DataGatheringScope);
};
class V8_EXPORT_PRIVATE ByteData : public ZoneObject,
......@@ -241,8 +243,6 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject,
#ifdef DEBUG
bool finalized_children_ = false;
#endif
DISALLOW_COPY_AND_ASSIGN(PreparseDataBuilder);
};
class ProducedPreparseData : public ZoneObject {
......@@ -289,6 +289,9 @@ class ConsumedPreparseData {
virtual ~ConsumedPreparseData() = default;
ConsumedPreparseData(const ConsumedPreparseData&) = delete;
ConsumedPreparseData& operator=(const ConsumedPreparseData&) = delete;
virtual ProducedPreparseData* GetDataForSkippableFunction(
Zone* zone, int start_position, int* end_position, int* num_parameters,
int* function_length, int* num_inner_functions, bool* uses_super_property,
......@@ -302,9 +305,6 @@ class ConsumedPreparseData {
protected:
ConsumedPreparseData() = default;
private:
DISALLOW_COPY_AND_ASSIGN(ConsumedPreparseData);
};
} // namespace internal
......
......@@ -823,6 +823,9 @@ class PreParserFormalParameters : public FormalParametersBase {
class PreParserFuncNameInferrer {
public:
explicit PreParserFuncNameInferrer(AstValueFactory* avf) {}
PreParserFuncNameInferrer(const PreParserFuncNameInferrer&) = delete;
PreParserFuncNameInferrer& operator=(const PreParserFuncNameInferrer&) =
delete;
void RemoveAsyncKeywordFromEnd() const {}
void Infer() const {}
void RemoveLastFunction() const {}
......@@ -830,13 +833,9 @@ class PreParserFuncNameInferrer {
class State {
public:
explicit State(PreParserFuncNameInferrer* fni) {}
private:
DISALLOW_COPY_AND_ASSIGN(State);
State(const State&) = delete;
State& operator=(const State&) = delete;
};
private:
DISALLOW_COPY_AND_ASSIGN(PreParserFuncNameInferrer);
};
class PreParserSourceRange {
......
......@@ -219,6 +219,8 @@ class V8_EXPORT_PRIVATE Scanner {
DCHECK_NOT_NULL(scanner_);
}
~BookmarkScope() = default;
BookmarkScope(const BookmarkScope&) = delete;
BookmarkScope& operator=(const BookmarkScope&) = delete;
void Set(size_t bookmark);
void Apply();
......@@ -232,8 +234,6 @@ class V8_EXPORT_PRIVATE Scanner {
Scanner* scanner_;
size_t bookmark_;
bool had_parser_error_;
DISALLOW_COPY_AND_ASSIGN(BookmarkScope);
};
// Sets the Scanner into an error state to stop further scanning and terminate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment