Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions build/v8_r19632/src/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,31 @@ class Literal V8_FINAL : public Expression {
ASSERT(!value_.is_null());
return value_->IsFalse();
}
bool IsUndefined() const {
ASSERT(!value_.is_null());
return value_->IsUndefined();
}
bool IsNumber() const {
ASSERT(!value_.is_null());
return value_->IsNumber();
}
bool IsJSObject() const {
ASSERT(!value_.is_null());
return value_->IsJSObject();
}
bool IsJSFunction() const {
ASSERT(!value_.is_null());
return value_->IsJSFunction();
}
bool IsJSArray() const {
ASSERT(!value_.is_null());
return value_->IsJSArray();
}
bool IsFixedArray() const {
ASSERT(!value_.is_null());
return value_->IsFixedArray();
}


Handle<Object> value() const { return value_; }

Expand Down
8 changes: 8 additions & 0 deletions src/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ void CAstNode::Expose(void)
.add_property("isNull", &CAstLiteral::IsNull)
.add_property("isTrue", &CAstLiteral::IsTrue)
.add_property("isFalse", &CAstLiteral::IsFalse)
.add_property("isUndefined", &CAstLiteral::IsUndefined)
.add_property("isNumber", &CAstLiteral::IsNumber)
.add_property("IsJSObject", &CAstLiteral::IsJSObject)
.add_property("isJSFunction", &CAstLiteral::IsJSFunction)
.add_property("isJSArray", &CAstLiteral::IsJSArray)
.add_property("isFixedArray", &CAstLiteral::IsFixedArray)
.add_property("asPropertyName", &CAstLiteral::AsPropertyName)
;

Expand Down Expand Up @@ -310,6 +316,8 @@ void CAstNode::Expose(void)
;

py::class_<CAstProperty, py::bases<CAstExpression> >("AstProperty", py::no_init)
.add_property("obj", &CAstProperty::obj)
.add_property("key", &CAstProperty::key)
;

py::class_<CAstCall, py::bases<CAstExpression> >("AstCall", py::no_init)
Expand Down
8 changes: 8 additions & 0 deletions src/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,12 @@ class CAstLiteral : public CAstExpression
bool IsNull(void) const { return as<v8i::Literal>()->IsNull(); }
bool IsTrue(void) const { return as<v8i::Literal>()->IsTrue(); }
bool IsFalse(void) const { return as<v8i::Literal>()->IsFalse(); }
bool IsUndefined(void) const { return as<v8i::Literal>()->IsUndefined(); }
bool IsNumber(void) const { return as<v8i::Literal>()->IsNumber(); }
bool IsJSObject(void) const { return as<v8i::Literal>()->IsJSObject(); }
bool IsJSFunction(void) const { return as<v8i::Literal>()->IsJSFunction(); }
bool IsJSArray(void) const { return as<v8i::Literal>()->IsJSArray(); }
bool IsFixedArray(void) const { return as<v8i::Literal>()->IsFixedArray(); }
};

class CAstMaterializedLiteral : public CAstExpression
Expand Down Expand Up @@ -601,6 +607,8 @@ class CAstProperty : public CAstExpression
{
public:
CAstProperty(v8i::Zone *zone, v8i::Property *prop) : CAstExpression(zone, prop) {}
py::object obj(void) const { return to_python(m_zone, as<v8i::Property>()->obj()); }
py::object key(void) const { return to_python(m_zone, as<v8i::Property>()->key()); }
};

class CAstCall : public CAstExpression
Expand Down