From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/stylus/lib/stack/frame.js | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 node_modules/stylus/lib/stack/frame.js (limited to 'node_modules/stylus/lib/stack/frame.js') diff --git a/node_modules/stylus/lib/stack/frame.js b/node_modules/stylus/lib/stack/frame.js new file mode 100644 index 00000000..ce3117d5 --- /dev/null +++ b/node_modules/stylus/lib/stack/frame.js @@ -0,0 +1,65 @@ + +/*! + * Stylus - stack - Frame + * Copyright (c) Automattic + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Scope = require('./scope'); + +/** + * Initialize a new `Frame` with the given `block`. + * + * @param {Block} block + * @api private + */ + +var Frame = module.exports = function Frame(block) { + this._scope = false === block.scope + ? null + : new Scope; + this.block = block; +}; + +/** + * Return this frame's scope or the parent scope + * for scope-less blocks. + * + * @return {Scope} + * @api public + */ + +Frame.prototype.__defineGetter__('scope', function(){ + return this._scope || this.parent.scope; +}); + +/** + * Lookup the given local variable `name`. + * + * @param {String} name + * @return {Node} + * @api private + */ + +Frame.prototype.lookup = function(name){ + return this.scope.lookup(name) +}; + +/** + * Custom inspect. + * + * @return {String} + * @api public + */ + +Frame.prototype.inspect = function(){ + return '[Frame ' + + (false === this.block.scope + ? 'scope-less' + : this.scope.inspect()) + + ']'; +}; -- cgit v1.2.3