瀏覽代碼

Object.dump() uses Object.allKeys() instead of Object.keys().

master
Ian Piumarta 1 年之前
父節點
當前提交
2761c99ce2
共有 2 個檔案被更改,包括 27 行新增16 行删除
  1. +23
    -14
      test.ref
  2. +4
    -2
      test.txt

+ 23
- 14
test.ref 查看文件

@ -9,8 +9,8 @@ o = Object.new(foo:42, bar: 666) => <>
o.foo => 42
Point.new() => <<Point>>
Point.new(x: 3, y: 4) => <<Point>>
| y: 4
| x: 3
| y: 4
twice 21 is 42
double => <<Closure>>
| environment: nil
@ -27,28 +27,39 @@ double => <>
Point.new(x:3, y:4).magnitude() => 5.000000
<<?>>
| self: nil =>
| self: nil
| n: 39
| self: nil
| 0: 40
40
<<?>>
| self: nil =>
| self: nil
| n: 40
| self: nil
| 0: 40
41
<<?>>
| self: nil =>
| self: nil
| n: 41
| self: nil
| 0: 40
42
<<?>>
| self: nil =>
| self: nil
| n: 42
| self: nil
| 0: 40
43
<Object>
| __codeon__: <primitive Object.codeOn>
| __eval__: <primitive Object.__eval__>
| __name__: Object
| allKeys: <primitive Object.allKeys>
| keys: <primitive Object.keys>
| length: <primitive Object.length>
| new: <primitive Object.new>
| pop: <primitive Object.pop>
| push: <primitive Object.push>
| sorted: <primitive Object.sorted>
nil no
1 yes
hello yes
@ -70,8 +81,8 @@ nil
<Object>
nil
[KEY: __delegate__
KEY: y
KEY: x
KEY: y
]
Symbol
<Symbol>
@ -147,14 +158,13 @@ MACRO table <>
| | | body: <<Object>>
| | | | 0: <<Call>>
| | | | | arguments: <<Object>>
| | | | | | 0: MACRO EVAL test with
| | | | | | 0: "MACRO EVAL test with "
| | | | | | 1: <<GetVar>>
| | | | | | | name: x
| | | | | | 2: and
| | | | | | 2: " and "
| | | | | | 3: <<GetVar>>
| | | | | | | name: y
| | | | | | 4:
| | | | | | 4: "\n"
| | | | | function: <<GetVar>>
| | | | | | name: print
| | | | 1: <<Unyop>>
@ -163,13 +173,12 @@ MACRO table <>
| | | | | | body: <<Object>>
| | | | | | | 0: <<Call>>
| | | | | | | | arguments: <<Object>>
| | | | | | | | | 0: REPLACEMENT
| | | | | | | | | 0: "REPLACEMENT "
| | | | | | | | | 1: <<Unyop>>
| | | | | | | | | | operation: 4
| | | | | | | | | | 0: <<GetVar>>
| | | | | | | | | | | name: x
| | | | | | | | | 2:
| | | | | | | | | 2: "\n"
| | | | | | | | function: <<GetVar>>
| | | | | | | | | name: print
| | | | | | | 1: <<Unyop>>
@ -193,7 +202,7 @@ AST eval => 42
65 66 67 68 69
1 two 3 four
test.txt:346: *: illegal operand types Integer and String
test.txt:381: *: illegal operand types Integer and String
11: n * factorial(n - 1)
10: if (n < 2) "1" else n * factorial(n - 1)
9: factorial(n - 1)

+ 4
- 2
test.txt 查看文件

@ -79,6 +79,8 @@ print(counter(), "\n");
print(counter(), "\n");
print(counter(), "\n");
print(Object, full:1, "\n");
test(x) { print(x, " "); if (x) print("yes\n") else print("no\n") }
test(nil);
@ -225,7 +227,7 @@ nil.__delegate__.__delegate__.__delegate__.println();
Object.dump()
{
print("[");
keys = self.keys();
keys = self.allKeys().sorted();
for (key in keys) print("KEY: ", key, "\n");
print("]\n");
}
@ -254,7 +256,7 @@ print("P.mag ", p.magnitude(), "\n");
o = [bar:666, 1, [2, 3, 6*7], foo:42];
print(o, "\n", full:1);
print(o, "\n", full: 1);
o.dump();

Loading…
取消
儲存