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

Unified Diff: src/full-codegen/full-codegen.h

Issue 1952633002: [full-codegen] Introduce NestedStatement subclass for class literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More tests Created 4 years, 7 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 | « no previous file | src/full-codegen/full-codegen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/full-codegen.h
diff --git a/src/full-codegen/full-codegen.h b/src/full-codegen/full-codegen.h
index 5642c0fe886fe5785fc1bc06572005a38016b041..0b71bd6a2e0d08b0cc60f3d1637b472b037dbd4e 100644
--- a/src/full-codegen/full-codegen.h
+++ b/src/full-codegen/full-codegen.h
@@ -211,6 +211,23 @@ class FullCodeGenerator: public AstVisitor {
}
};
+ // A class literal expression
+ class NestedClassLiteral : public NestedStatement {
+ public:
+ NestedClassLiteral(FullCodeGenerator* codegen, ClassLiteral* lit)
+ : NestedStatement(codegen),
+ needs_context_(lit->scope() != nullptr &&
+ lit->scope()->NeedsContext()) {}
+
+ NestedStatement* Exit(int* context_length) override {
+ if (needs_context_) ++(*context_length);
+ return previous_;
+ }
+
+ private:
+ const bool needs_context_;
+ };
+
class DeferredCommands {
public:
enum Command { kReturn, kThrow, kBreak, kContinue };
« no previous file with comments | « no previous file | src/full-codegen/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698