Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: src/utils.h

Issue 2654423004: [async-functions] support await expressions in finally statements (Closed)
Patch Set: I'd like to build with -Wunused-variables locally, but how!? Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/preparser.cc ('k') | test/cctest/interpreter/bytecode_expectations/Generators.golden » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils.h
diff --git a/src/utils.h b/src/utils.h
index 6d0d3c84a3845750283340bf2bf611576f460994..7f5cf19fc70608442df9cd5253aac34ad6a2a288 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -1707,6 +1707,25 @@ class ThreadedListZoneEntry final : public ZoneObject {
DISALLOW_COPY_AND_ASSIGN(ThreadedListZoneEntry);
};
+template <typename T>
+class ScopedAssignment {
+ public:
+ V8_INLINE ScopedAssignment(T& previous, T&& value)
+ : location_(&previous), prev_(previous) {
+ *location_ = value;
+ }
+ V8_INLINE ScopedAssignment(T& previous, const T& value)
+ : location_(&previous), prev_(previous) {
+ *location_ = value;
+ }
+
+ V8_INLINE ~ScopedAssignment() { *location_ = prev_; }
+
+ private:
+ T* location_;
+ T prev_;
+};
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/parsing/preparser.cc ('k') | test/cctest/interpreter/bytecode_expectations/Generators.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698