Class: Variable

Defined in: src/nodes/variable.coffee
Inherits: Node

Overview

The Node representation of a CoffeeScript variable.

Instance Method Summary

Inherited Method Summary

Methods inherited from Node

.findAncestor

Constructor Details

.constructor(entity, node, smc, options, classType = false, comment = null)

Construct a variable node.

Parameters:

  • (Class) entityThe variable's Class
  • (Object) nodeThe variable node (a {Object})
  • smcAn object mapping the actual position of a member to its Biscotto one
  • (Object) optionsThe parser options (a {Object})
  • (Boolean) classTypeA {Boolean} indicating if the class is a class or an instance
  • (Object) commentThe comment node (a {Object})

Instance Method Details

.getDoc()

Get the class doc

Returns:

  • Returns the class doc (a [Doc]).

Number .getLocation()

Get the source line number

Returns:

  • (Number) — Returns a {Number}.

String .getName()

Get the variable name

Returns:

  • (String) — Returns the variable name (a {String}).

String .getType()

Get the variable type, either class or constant

Returns:

  • (String) — Returns the variable type (a {String}).

String .getValue()

Get the variable value.

Returns:

  • (String) — Returns the value (a {String}).

Boolean .isConstant()

Test if the given value should be treated ad constant.

Returns:

  • (Boolean) — Returns true if a constant (a {Boolean})

Object .toJSON()

Get a JSON representation of the object

Returns:

  • (Object) — Returns the JSON object (a {Object}).