Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index c08e62cd3ac4e765b41aae0880c627dc1067ac4e..0802c3aebacf587f14bf33758316f5347b4bf933 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -284,6 +284,7 @@ class Typer::Visitor : public Reducer { |
#undef DECLARE_METHOD |
static Type* ObjectIsCallable(Type*, Typer*); |
+ static Type* ObjectIsNonCallable(Type*, Typer*); |
static Type* ObjectIsNumber(Type*, Typer*); |
static Type* ObjectIsReceiver(Type*, Typer*); |
static Type* ObjectIsSmi(Type*, Typer*); |
@@ -502,8 +503,14 @@ Type* Typer::Visitor::ToString(Type* type, Typer* t) { |
// Type checks. |
Type* Typer::Visitor::ObjectIsCallable(Type* type, Typer* t) { |
- if (type->Is(Type::Function())) return t->singleton_true_; |
- if (type->Is(Type::Primitive())) return t->singleton_false_; |
+ if (type->Is(Type::Callable())) return t->singleton_true_; |
bakkot1
2017/01/23 19:26:16
Drive-by comment: document.all is "callable", in t
Benedikt Meurer
2017/02/14 10:18:24
Aye, sorry for the delay, just discovered this com
|
+ if (!type->Maybe(Type::Callable())) return t->singleton_false_; |
+ return Type::Boolean(); |
+} |
+ |
+Type* Typer::Visitor::ObjectIsNonCallable(Type* type, Typer* t) { |
+ if (type->Is(Type::NonCallable())) return t->singleton_true_; |
+ if (!type->Maybe(Type::NonCallable())) return t->singleton_false_; |
return Type::Boolean(); |
} |
@@ -1828,6 +1835,10 @@ Type* Typer::Visitor::TypeObjectIsCallable(Node* node) { |
return TypeUnaryOp(node, ObjectIsCallable); |
} |
+Type* Typer::Visitor::TypeObjectIsNonCallable(Node* node) { |
+ return TypeUnaryOp(node, ObjectIsNonCallable); |
+} |
+ |
Type* Typer::Visitor::TypeObjectIsNumber(Node* node) { |
return TypeUnaryOp(node, ObjectIsNumber); |
} |