Sha256: 98c8fc2b95a71b10c7d4cbaeae6b0ce005f0074d55b0c2301b55fa68db39fbf7
Contents?: true
Size: 725 Bytes
Versions: 3
Compression:
Stored size: 725 Bytes
Contents
require_relative '../exceptions' module Dentaku module AST class Identifier < Node attr_reader :identifier def initialize(token) @identifier = token.value.downcase end def value(context={}) v = context[identifier] case v when Node v.value(context) when NilClass raise UnboundVariableError.new([identifier]) else v end end def dependencies(context={}) context.has_key?(identifier) ? dependencies_of(context[identifier]) : [identifier] end private def dependencies_of(node) node.respond_to?(:dependencies) ? node.dependencies : [] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dentaku-2.0.6 | lib/dentaku/ast/identifier.rb |
dentaku-2.0.5 | lib/dentaku/ast/identifier.rb |
dentaku-2.0.4 | lib/dentaku/ast/identifier.rb |