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

Unified Diff: src/ast.h

Issue 22144006: Un-revert "Implement simple effect typing for variables" and "Handle switch effects" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix building with clang Created 7 years, 4 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/effects.h » ('j') | no next file with comments »
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 f6066e7123b404d367e3ebcb38068931861faca3..db8cb2e3676d053f9ac1243d2de596a140c04162 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -259,6 +259,7 @@ class Statement: public AstNode {
Statement() : statement_pos_(RelocInfo::kNoPosition) {}
bool IsEmpty() { return AsEmptyStatement() != NULL; }
+ virtual bool IsJump() const { return false; }
void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
int statement_pos() const { return statement_pos_; }
@@ -388,7 +389,7 @@ class Expression: public AstNode {
protected:
explicit Expression(Isolate* isolate)
- : bounds_(Type::None(), Type::Any(), isolate),
+ : bounds_(Bounds::Unbounded(isolate)),
id_(GetNextId(isolate)),
test_id_(GetNextId(isolate)) {}
void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
@@ -458,6 +459,11 @@ class Block: public BreakableStatement {
ZoneList<Statement*>* statements() { return &statements_; }
bool is_initializer_block() const { return is_initializer_block_; }
+ virtual bool IsJump() const {
+ return !statements_.is_empty() && statements_.last()->IsJump()
+ && labels() == NULL; // Good enough as an approximation...
+ }
+
Scope* scope() const { return scope_; }
void set_scope(Scope* scope) { scope_ = scope; }
@@ -1008,6 +1014,7 @@ class ExpressionStatement: public Statement {
void set_expression(Expression* e) { expression_ = e; }
Expression* expression() const { return expression_; }
+ virtual bool IsJump() const { return expression_->IsThrow(); }
protected:
explicit ExpressionStatement(Expression* expression)
@@ -1018,7 +1025,16 @@ class ExpressionStatement: public Statement {
};
-class ContinueStatement: public Statement {
+class JumpStatement: public Statement {
+ public:
+ virtual bool IsJump() const { return true; }
+
+ protected:
+ JumpStatement() {}
+};
+
+
+class ContinueStatement: public JumpStatement {
public:
DECLARE_NODE_TYPE(ContinueStatement)
@@ -1033,7 +1049,7 @@ class ContinueStatement: public Statement {
};
-class BreakStatement: public Statement {
+class BreakStatement: public JumpStatement {
public:
DECLARE_NODE_TYPE(BreakStatement)
@@ -1048,7 +1064,7 @@ class BreakStatement: public Statement {
};
-class ReturnStatement: public Statement {
+class ReturnStatement: public JumpStatement {
public:
DECLARE_NODE_TYPE(ReturnStatement)
@@ -1167,6 +1183,11 @@ class IfStatement: public Statement {
Statement* then_statement() const { return then_statement_; }
Statement* else_statement() const { return else_statement_; }
+ virtual bool IsJump() const {
+ return HasThenStatement() && then_statement()->IsJump()
+ && HasElseStatement() && else_statement()->IsJump();
+ }
+
BailoutId IfId() const { return if_id_; }
BailoutId ThenId() const { return then_id_; }
BailoutId ElseId() const { return else_id_; }
« no previous file with comments | « no previous file | src/effects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698