Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (29 sloc) 1.33 kb

NAME

PAST::Pattern::Constant - A PAST::Pattern subclass for exact matching of constants.

DESCRIPTION

A PAST::Pattern::Constant matches objects that are equal to(according to the is_equal vtable) its value.

PAST::Pattern::Constant is PAST::Pattern

A PAST::Pattern::Constant contains a constant value. This constant value specifies what objects the pattern matches. The pattern matches if the is_equal vtable of the value produces a true result when called with the object to be matched.

PAST::Pattern::patternize produces a PAST::Pattern::Constant when called with an object which neither has an ACCEPTS method nor provides the invokable role.

Attributes

value

The value attribute holds the constant value that must be equal to any matching objects. If the value lacks an is_equal vtable, the ACCEPTSEXACTLY method will throw an exception.

Methods

new(value)

Creates a PAST::Pattern::Constant with value as its constant target value.

value([new_value])

If new_value is provided, set the value attribute of the pattern to new_value. Otherwise, return the current value of the value attribute.

ACCEPTSEXACTLY(node)

Used internally by the inherited ACCEPTS method to determine whether a node exactly matches the pattern.

Jump to Line
Something went wrong with that request. Please try again.