source: trip-planner-front/node_modules/stylus/lib/stack/frame.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[6a3a178]1
2/*!
3 * Stylus - stack - Frame
4 * Copyright (c) Automattic <developer.wordpress.com>
5 * MIT Licensed
6 */
7
8/**
9 * Module dependencies.
10 */
11
12var Scope = require('./scope');
13
14/**
15 * Initialize a new `Frame` with the given `block`.
16 *
17 * @param {Block} block
18 * @api private
19 */
20
21var Frame = module.exports = function Frame(block) {
22 this._scope = false === block.scope
23 ? null
24 : new Scope;
25 this.block = block;
26};
27
28/**
29 * Return this frame's scope or the parent scope
30 * for scope-less blocks.
31 *
32 * @return {Scope}
33 * @api public
34 */
35
36Frame.prototype.__defineGetter__('scope', function(){
37 return this._scope || this.parent.scope;
38});
39
40/**
41 * Lookup the given local variable `name`.
42 *
43 * @param {String} name
44 * @return {Node}
45 * @api private
46 */
47
48Frame.prototype.lookup = function(name){
49 return this.scope.lookup(name)
50};
51
52/**
53 * Custom inspect.
54 *
55 * @return {String}
56 * @api public
57 */
58
59Frame.prototype.inspect = function(){
60 return '[Frame '
61 + (false === this.block.scope
62 ? 'scope-less'
63 : this.scope.inspect())
64 + ']';
65};
Note: See TracBrowser for help on using the repository browser.