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

Unified Diff: src/typing.h

Issue 17842004: Derive synthetic type bounds for expressions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simplify assignment Created 7 years, 6 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/typing.cc » ('j') | src/typing.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typing.h
diff --git a/src/typing.h b/src/typing.h
index 2d3fac0650959cb9f6ac719b3973456510702b69..a3d48623a6de35e1979620fb37ba76778f42c8b0 100644
--- a/src/typing.h
+++ b/src/typing.h
@@ -68,6 +68,20 @@ class AstTyper: public AstVisitor {
void MergeUpperType(Expression* e, Handle<Type> t) {
e->set_upper_type(handle(Type::Intersect(e->upper_type(), t), isolate_));
}
+ void MergeLowerType(Expression* e, Type* t) {
+ MergeLowerType(e, handle(t, isolate_));
+ }
+ void MergeUpperType(Expression* e, Type* t) {
+ MergeUpperType(e, handle(t, isolate_));
+ }
+
+ static Type* BoundedType(Type* bound, Handle<Type> type) {
+ return type->Is(bound) ? *type : bound;
+ }
+ static Type* AdditionType(Handle<Type> type) {
+ return type->Is(Type::Number()) ? Type::Number() :
+ type->Is(Type::String()) ? Type::String() : Type::NumberOrString();
+ }
void VisitDeclarations(ZoneList<Declaration*>* declarations);
void VisitStatements(ZoneList<Statement*>* statements);
« no previous file with comments | « no previous file | src/typing.cc » ('j') | src/typing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698