A toy dynamic programming language written in Ruby
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

class_definition.rb 392B

12345678910111213141516171819
  1. class AST::ClassDefinition
  2. attr_reader :name, :members, :methods
  3. def initialize(name, members, methods)
  4. @name = name
  5. @members = members
  6. @methods = methods
  7. end
  8. def ==(other)
  9. other.is_a?(AST::ClassDefinition) && other.name == @name &&
  10. other.members == @members &&
  11. other.methods == @methods
  12. end
  13. def execute(env)
  14. env.set(@name.name, self)
  15. end
  16. end