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

Unified Diff: src/ast.h

Issue 1084983002: [strong] Implement static restrictions on switch statement (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/messages.js » ('j') | src/messages.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 7bfa02178faabb6e09af3c3f8d8f303393da88d1..42fffd570294454a8613de408b9efaba38fa6d17 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -280,6 +280,7 @@ class Statement : public AstNode {
bool IsEmpty() { return AsEmptyStatement() != NULL; }
virtual bool IsJump() const { return false; }
+ virtual bool IsStrongSwitchTerminatingStatement() const { return false; }
rossberg 2015/04/14 20:19:49 I'm tempted to get rid of this and just use IsJump
conradw 2015/04/15 11:40:03 Done.
};
@@ -514,6 +515,9 @@ class Block FINAL : public BreakableStatement {
return !statements_.is_empty() && statements_.last()->IsJump()
&& labels() == NULL; // Good enough as an approximation...
}
+ bool IsStrongSwitchTerminatingStatement() const OVERRIDE {
+ return IsJump();
+ }
Scope* scope() const { return scope_; }
void set_scope(Scope* scope) { scope_ = scope; }
@@ -1019,6 +1023,7 @@ class ExpressionStatement FINAL : public Statement {
void set_expression(Expression* e) { expression_ = e; }
Expression* expression() const { return expression_; }
bool IsJump() const OVERRIDE { return expression_->IsThrow(); }
+ bool IsStrongSwitchTerminatingStatement() const OVERRIDE { return IsJump(); }
protected:
ExpressionStatement(Zone* zone, Expression* expression, int pos)
@@ -1032,6 +1037,7 @@ class ExpressionStatement FINAL : public Statement {
class JumpStatement : public Statement {
public:
bool IsJump() const FINAL { return true; }
+ bool IsStrongSwitchTerminatingStatement() const FINAL { return true; }
protected:
explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {}
« no previous file with comments | « no previous file | src/messages.js » ('j') | src/messages.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698