Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
SkSL::Parser::Checkpoint Class Reference

Public Member Functions

 Checkpoint (Parser *p)
 
 ~Checkpoint ()
 
void accept ()
 
void rewind ()
 

Detailed Description

Definition at line 151 of file SkSLParser.cpp.

Constructor & Destructor Documentation

◆ Checkpoint()

SkSL::Parser::Checkpoint::Checkpoint ( Parser p)
inline

Definition at line 153 of file SkSLParser.cpp.

153 : fParser(p) {
154 Context& context = fParser->fCompiler.context();
155 fPushbackCheckpoint = fParser->fPushback;
156 fLexerCheckpoint = fParser->fLexer.getCheckpoint();
157 fOldErrorReporter = context.fErrors;
158 fOldEncounteredFatalError = fParser->fEncounteredFatalError;
159 SkASSERT(fOldErrorReporter);
160 context.setErrorReporter(&fErrorReporter);
161 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
Context & context() const
Definition: SkSLCompiler.h:143
Checkpoint getCheckpoint() const
Definition: SkSLLexer.h:136

◆ ~Checkpoint()

SkSL::Parser::Checkpoint::~Checkpoint ( )
inline

Definition at line 163 of file SkSLParser.cpp.

163 {
164 SkASSERTF(!fOldErrorReporter, "Checkpoint was not accepted or rewound before destruction");
165 }
#define SkASSERTF(cond, fmt,...)
Definition: SkAssert.h:117

Member Function Documentation

◆ accept()

void SkSL::Parser::Checkpoint::accept ( )
inline

Definition at line 167 of file SkSLParser.cpp.

167 {
168 this->restoreErrorReporter();
169 // Parser errors should have been fatal, but we can encounter other errors like type
170 // mismatches despite accepting the parse. Forward those messages to the actual error
171 // handler now.
172 fErrorReporter.forwardErrors(fParser);
173 }

◆ rewind()

void SkSL::Parser::Checkpoint::rewind ( )
inline

Definition at line 175 of file SkSLParser.cpp.

175 {
176 this->restoreErrorReporter();
177 fParser->fPushback = fPushbackCheckpoint;
178 fParser->fLexer.rewindToCheckpoint(fLexerCheckpoint);
179 fParser->fEncounteredFatalError = fOldEncounteredFatalError;
180 }
void rewindToCheckpoint(Checkpoint checkpoint)
Definition: SkSLLexer.h:138

The documentation for this class was generated from the following file: