1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] Fix a little documentation for the stack-handling additions.

This commit is contained in:
Nathan Weizenbaum 2010-04-11 14:32:02 -07:00
parent 577c234abb
commit a5ce4eef71

View file

@ -38,20 +38,20 @@ module Sass
# Push lexical frame information onto the runtime stack. # Push lexical frame information onto the runtime stack.
# @param frame_info [{Symbol => Object}] # @param frame_info [{Symbol => Object}]
# Frame information has the following keys: # Frame information has the following keys:
# #
# `:filename` # `:filename`
# : The name of the file in which the lexical scope changed. # : The name of the file in which the lexical scope changed.
# #
# `:mixin` # `:mixin`
# : The name of the mixin in which the lexical scope changed, # : The name of the mixin in which the lexical scope changed,
# or `nil` if it wasn't within in a mixin. # or `nil` if it wasn't within in a mixin.
# #
# `:line` # `:line`
# : The line of the file on which the lexical scope changed. Never nil. # : The line of the file on which the lexical scope changed. Never nil.
# #
# `:import` # `:import`
# : Set to `true` when the lexical scope is changing due to an import. # : Set to `true` when the lexical scope is changing due to an import.
def push(frame_info) def push(frame_info)
@stack.push frame_info @stack.push frame_info
end end
@ -63,13 +63,19 @@ module Sass
# A list of the runtime stack frame information # A list of the runtime stack frame information
# The last element in the list was pushed onto the stack most recently. # The last element in the list was pushed onto the stack most recently.
#
# @return [Array<{Symbol => Object}>] The stack frames,
# of the form passed to \{#push}.
def stack def stack
prev = (!@ignore_parent_stack && parent && parent.stack) || [] prev = (!@ignore_parent_stack && parent && parent.stack) || []
prev + @stack prev + @stack
end end
# Temporarily assume the runtime stack that is passed in. # Temporarily assume the runtime stack that is passed in.
# @param stk A stack value from another environment. #
# @param stk [Array<{Symbol => Object}>] A call stack from another environment,
# of the form returned by \{#stack}.
# @yield A block in which the stack is set to `stk`.
def with_stack(stk) def with_stack(stk)
@stack, old_stack = stk, @stack @stack, old_stack = stk, @stack
@ignore_parent_stack = true @ignore_parent_stack = true