Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6a3a178] | 1 |
|
---|
| 2 | /*!
|
---|
| 3 | * Stylus - UnaryOp
|
---|
| 4 | * Copyright (c) Automattic <developer.wordpress.com>
|
---|
| 5 | * MIT Licensed
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | /**
|
---|
| 9 | * Module dependencies.
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | var Node = require('./node');
|
---|
| 13 |
|
---|
| 14 | /**
|
---|
| 15 | * Initialize a new `UnaryOp` with `op`, and `expr`.
|
---|
| 16 | *
|
---|
| 17 | * @param {String} op
|
---|
| 18 | * @param {Node} expr
|
---|
| 19 | * @api public
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | var UnaryOp = module.exports = function UnaryOp(op, expr){
|
---|
| 23 | Node.call(this);
|
---|
| 24 | this.op = op;
|
---|
| 25 | this.expr = expr;
|
---|
| 26 | };
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * Inherit from `Node.prototype`.
|
---|
| 30 | */
|
---|
| 31 |
|
---|
| 32 | UnaryOp.prototype.__proto__ = Node.prototype;
|
---|
| 33 |
|
---|
| 34 | /**
|
---|
| 35 | * Return a clone of this node.
|
---|
| 36 | *
|
---|
| 37 | * @return {Node}
|
---|
| 38 | * @api public
|
---|
| 39 | */
|
---|
| 40 |
|
---|
| 41 | UnaryOp.prototype.clone = function(parent){
|
---|
| 42 | var clone = new UnaryOp(this.op);
|
---|
| 43 | clone.expr = this.expr.clone(parent, clone);
|
---|
| 44 | clone.lineno = this.lineno;
|
---|
| 45 | clone.column = this.column;
|
---|
| 46 | clone.filename = this.filename;
|
---|
| 47 | return clone;
|
---|
| 48 | };
|
---|
| 49 |
|
---|
| 50 | /**
|
---|
| 51 | * Return a JSON representation of this node.
|
---|
| 52 | *
|
---|
| 53 | * @return {Object}
|
---|
| 54 | * @api public
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | UnaryOp.prototype.toJSON = function(){
|
---|
| 58 | return {
|
---|
| 59 | __type: 'UnaryOp',
|
---|
| 60 | op: this.op,
|
---|
| 61 | expr: this.expr,
|
---|
| 62 | lineno: this.lineno,
|
---|
| 63 | column: this.column,
|
---|
| 64 | filename: this.filename
|
---|
| 65 | };
|
---|
| 66 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.