Skip to content

Instantly share code, notes, and snippets.

@bakkdoor
Created May 4, 2011 07:57
Show Gist options
  • Save bakkdoor/954896 to your computer and use it in GitHub Desktop.
Save bakkdoor/954896 to your computer and use it in GitHub Desktop.
false/nil/true -> methods
diff --git a/lib/compiler/ast/identifier.fy b/lib/compiler/ast/identifier.fy
index 591036b..49e70fa 100644
--- a/lib/compiler/ast/identifier.fy
+++ b/lib/compiler/ast/identifier.fy
@@ -53,9 +53,9 @@ class Fancy AST {
def bytecode: g {
pos(g)
match @string {
- case "true" -> g push_true()
- case "false" -> g push_false()
- case "nil" -> g push_nil()
+ # case "true" -> g push_true()
+ # case "false" -> g push_false()
+ # case "nil" -> g push_nil()
case _ ->
if: (g state() scope() search_local(name)) then: {
Rubinius AST LocalVariableAccess new(@line, name) bytecode(g)
diff --git a/lib/rbx/object.fy b/lib/rbx/object.fy
index aeef637..435d4c1 100644
--- a/lib/rbx/object.fy
+++ b/lib/rbx/object.fy
@@ -23,6 +23,25 @@ class Object {
initialize()
}
+ dynamic_method('false) |g| {
+ g push_false()
+ g ret()
+ }
+
+ dynamic_method('true) |g| {
+ g push_true()
+ g ret()
+ }
+
+ dynamic_method('nil) |g| {
+ g push_nil()
+ g ret()
+ }
+
+ ruby_alias: 'false
+ ruby_alias: 'true
+ ruby_alias: 'nil
+
def require: file_path {
"""
Loads and evaluates a given Fancy source file by trying to find the specified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment