Created
April 29, 2014 20:13
-
-
Save mieko/2a238e98fb005b7de60c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Opal | |
module Nodes | |
module SexpNode | |
def self.from_sexp(*) # Imagine the extend(ClassMethods) dance. | |
end | |
end | |
end | |
end | |
class Opal::Nodes::BaseNode | |
include SexpNode | |
end | |
# Goal: | |
node = s(:args, ...) | |
node.class # => Opal::Compiler::ArgsNode | |
node.is_a?(Sexp) # => true | |
node.kwrest? # Can have ArgsNode-specific methods | |
node.children # But still is a Sexp | |
node.to_s # (:args ...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment