1.1 --- a/micropython/ast.py Mon May 25 00:45:53 2009 +0200
1.2 +++ b/micropython/ast.py Fri May 29 00:18:40 2009 +0200
1.3 @@ -168,14 +168,14 @@
1.4
1.5 init_method = cls.get_init_method()
1.6
1.7 + # Fix the current frame to include a new storage slot at the beginning.
1.8 +
1.9 + self.new_op(AdjustFrame(-1))
1.10 +
1.11 # Convert this frame back to being an invocation frame.
1.12
1.13 self.new_op(RecoverFrame())
1.14
1.15 - # Fix the current frame to include a new storage slot at the beginning.
1.16 -
1.17 - self.new_op(AdjustFrame(-1))
1.18 -
1.19 # Make an object.
1.20
1.21 self.make_object(cls, len(cls.instance_attributes()))
2.1 --- a/rsvp.py Mon May 25 00:45:53 2009 +0200
2.2 +++ b/rsvp.py Fri May 29 00:18:40 2009 +0200
2.3 @@ -280,21 +280,24 @@
2.4 self.run()
2.5 success = 1
2.6
2.7 - for name in module.keys():
2.8 - if name.startswith("result"):
2.9 - label, expected = name.split("_")
2.10 - attr = module[name]
2.11 + if self.exception is None:
2.12 + for name in module.keys():
2.13 + if name.startswith("result"):
2.14 + label, expected = name.split("_")
2.15 + attr = module[name]
2.16
2.17 - # NOTE: Assumptions about headers and content made.
2.18 + # NOTE: Assumptions about headers and content made.
2.19
2.20 - attr_location = module.location + 1 + attr.position
2.21 - context, ref = self.load(attr_location)
2.22 - content = self.load(ref + 1)
2.23 - print label, expected, content
2.24 + attr_location = module.location + 1 + attr.position
2.25 + context, ref = self.load(attr_location)
2.26 + content = self.load(ref + 1)
2.27 + print label, expected, content
2.28
2.29 - success = success and (int(expected) == content)
2.30 + success = success and (int(expected) == content)
2.31
2.32 - return success
2.33 + return success
2.34 + else:
2.35 + return 0
2.36
2.37 def execute(self):
2.38
2.39 @@ -509,7 +512,7 @@
2.40 self.frame_stack = self.frame_stack[:frame] # reset stack before call
2.41
2.42 def RecoverFrame(self):
2.43 - self.local_sp_stack.pop()
2.44 + self.invocation_sp_stack[-1] = self.local_sp_stack.pop()
2.45
2.46 def StoreFrame(self):
2.47 frame = self.invocation_sp_stack[-1] # different from the current frame after MakeFrame
2.48 @@ -618,7 +621,7 @@
2.49 self.frame_stack.extend([None] * self.operand)
2.50
2.51 def AdjustFrame(self):
2.52 - self.invocation_sp_stack[-1] += self.operand
2.53 + self.local_sp_stack[-1] += self.operand
2.54
2.55 def Return(self):
2.56 return self.pull_pc()
3.1 --- a/tests/call_func.py Mon May 25 00:45:53 2009 +0200
3.2 +++ b/tests/call_func.py Fri May 29 00:18:40 2009 +0200
3.3 @@ -3,8 +3,8 @@
3.4 def f(a, b, c):
3.5 return c
3.6
3.7 -x = f(1, 2, 3)
3.8 -y = f(1, b=2, c=3)
3.9 -z = f(c=3, b=2, a=1)
3.10 +result1_3 = f(1, 2, 3)
3.11 +result2_3 = f(1, b=2, c=3)
3.12 +result3_3 = f(c=3, b=2, a=1)
3.13
3.14 # vim: tabstop=4 expandtab shiftwidth=4
4.1 --- a/tests/call_func_default.py Mon May 25 00:45:53 2009 +0200
4.2 +++ b/tests/call_func_default.py Fri May 29 00:18:40 2009 +0200
4.3 @@ -3,7 +3,7 @@
4.4 def f(a, b, c=4):
4.5 return c
4.6
4.7 -r1 = f(1, 2, 3)
4.8 -r2 = f(1, 2)
4.9 +result_3 = f(1, 2, 3)
4.10 +result_4 = f(1, 2)
4.11
4.12 # vim: tabstop=4 expandtab shiftwidth=4
5.1 --- a/tests/call_func_default_keyword.py Mon May 25 00:45:53 2009 +0200
5.2 +++ b/tests/call_func_default_keyword.py Fri May 29 00:18:40 2009 +0200
5.3 @@ -3,9 +3,9 @@
5.4 def f(a, b, c=4):
5.5 return c
5.6
5.7 -p = f(1, 2, 3)
5.8 -q = f(1, b=2, c=3)
5.9 -r = f(c=3, b=2, a=1)
5.10 -s = f(1, 2)
5.11 +result1_3 = f(1, 2, 3)
5.12 +result2_3 = f(1, b=2, c=3)
5.13 +result3_3 = f(c=3, b=2, a=1)
5.14 +result_4 = f(1, 2)
5.15
5.16 # vim: tabstop=4 expandtab shiftwidth=4
6.1 --- a/tests/call_func_default_non_constant.py Mon May 25 00:45:53 2009 +0200
6.2 +++ b/tests/call_func_default_non_constant.py Fri May 29 00:18:40 2009 +0200
6.3 @@ -6,7 +6,7 @@
6.4 def h(a, b, c=f(5, 4, 3)):
6.5 return c
6.6
6.7 -x = h(1, 2, 3) # -> 3
6.8 -y = h(1, 2) # -> 4
6.9 +result_3 = h(1, 2, 3) # h(c=3) -> 3
6.10 +result_4 = h(1, 2) # h(c=f(5, 4, 3)) -> h(c=f(b=4)) -> h(c=4) -> 4
6.11
6.12 # vim: tabstop=4 expandtab shiftwidth=4
7.1 --- a/tests/call_func_default_redefine.py Mon May 25 00:45:53 2009 +0200
7.2 +++ b/tests/call_func_default_redefine.py Fri May 29 00:18:40 2009 +0200
7.3 @@ -4,13 +4,14 @@
7.4 return c
7.5
7.6 g = f
7.7 -r1 = g(1, c=3, b=2) # -> 3
7.8 -r2 = g(1, 2) # -> 4
7.9 +
7.10 +result_3 = g(1, c=3, b=2) # f(c=3) -> 3
7.11 +result_4 = g(1, 2) # f(c=4) -> 4
7.12
7.13 def g(a, c, b=5):
7.14 return b
7.15
7.16 -r3 = g(1, c=3, b=2) # -> 2
7.17 -r4 = g(1, 3) # -> 5
7.18 +result_2 = g(1, c=3, b=2) # g(b=2) -> 2
7.19 +result_5 = g(1, 3) # g(b=5) -> 5
7.20
7.21 # vim: tabstop=4 expandtab shiftwidth=4
8.1 --- a/tests/call_func_extra.py Mon May 25 00:45:53 2009 +0200
8.2 +++ b/tests/call_func_extra.py Fri May 29 00:18:40 2009 +0200
8.3 @@ -1,21 +1,22 @@
8.4 #!/usr/bin/env python
8.5
8.6 def f(a, b, *c):
8.7 - pass
8.8 + return c
8.9
8.10 -f(1, 2, 3)
8.11 -f(1, b=2)
8.12 -f(1, 2, 3, 4)
8.13 +r1 = f(1, 2, 3)
8.14 +r2 = f(1, b=2)
8.15 +r3 = f(1, 2, 3, 4)
8.16
8.17 g = f
8.18 -g(1, 2, 3)
8.19 -g(1, b=2)
8.20 -g(1, 2, 3, 4)
8.21 +
8.22 +r4 = g(1, 2, 3)
8.23 +r5 = g(1, b=2)
8.24 +r6 = g(1, 2, 3, 4)
8.25
8.26 def g(a, c, *b):
8.27 - pass
8.28 + return b
8.29
8.30 -g(1, c=2)
8.31 -g(1, 2, 3, 4)
8.32 +r7 = g(1, c=2)
8.33 +r8 = g(1, 2, 3, 4)
8.34
8.35 # vim: tabstop=4 expandtab shiftwidth=4
9.1 --- a/tests/call_func_keyword.py Mon May 25 00:45:53 2009 +0200
9.2 +++ b/tests/call_func_keyword.py Fri May 29 00:18:40 2009 +0200
9.3 @@ -1,18 +1,14 @@
9.4 #!/usr/bin/env python
9.5
9.6 def f(a, b, **c):
9.7 - pass
9.8 + return c
9.9
9.10 -f(1, 2, 3)
9.11 -f(1, b=2, c=3, d=4)
9.12 -f(c=3, b=2, a=1, d=4)
9.13 +r1 = f(1, 2, 3)
9.14 +r2 = f(1, b=2, c=3, d=4)
9.15 +r3 = f(c=3, b=2, a=1, d=4)
9.16
9.17 g = f
9.18 -g(1, c=3, b=2, d=4)
9.19
9.20 -def g(a, c, b):
9.21 - pass
9.22 -
9.23 -g(1, c=3, b=2, d=4)
9.24 +r4 = g(1, c=3, b=2, d=4)
9.25
9.26 # vim: tabstop=4 expandtab shiftwidth=4
10.1 --- a/tests/call_func_star_parameter_unpack.py Mon May 25 00:45:53 2009 +0200
10.2 +++ b/tests/call_func_star_parameter_unpack.py Fri May 29 00:18:40 2009 +0200
10.3 @@ -4,6 +4,6 @@
10.4 a, b, c = args
10.5 return c
10.6
10.7 -x = f(1, 2, 3)
10.8 +result_3 = f(1, 2, 3)
10.9
10.10 # vim: tabstop=4 expandtab shiftwidth=4
11.1 --- a/tests/call_func_uncertain.py Mon May 25 00:45:53 2009 +0200
11.2 +++ b/tests/call_func_uncertain.py Fri May 29 00:18:40 2009 +0200
11.3 @@ -4,11 +4,12 @@
11.4 return c
11.5
11.6 g = f
11.7 -x = g(1, c=3, b=2)
11.8 +
11.9 +result1_3 = g(1, c=3, b=2)
11.10
11.11 def g(a, c, b):
11.12 return c
11.13
11.14 -y = g(1, c=3, b=2)
11.15 +result2_3 = g(1, c=3, b=2)
11.16
11.17 # vim: tabstop=4 expandtab shiftwidth=4
12.1 --- a/tests/call_instance.py Mon May 25 00:45:53 2009 +0200
12.2 +++ b/tests/call_instance.py Fri May 29 00:18:40 2009 +0200
12.3 @@ -2,9 +2,9 @@
12.4
12.5 class C:
12.6 def __call__(self):
12.7 - return "called"
12.8 + return 42
12.9
12.10 c = C()
12.11 -result = c()
12.12 +result_42 = c()
12.13
12.14 # vim: tabstop=4 expandtab shiftwidth=4
13.1 --- a/tests/call_instance_attribute.py Mon May 25 00:45:53 2009 +0200
13.2 +++ b/tests/call_instance_attribute.py Fri May 29 00:18:40 2009 +0200
13.3 @@ -2,7 +2,7 @@
13.4
13.5 class C:
13.6 def __call__(self):
13.7 - return "called"
13.8 + return 42
13.9
13.10 class D:
13.11 def __init__(self, x):
13.12 @@ -10,6 +10,6 @@
13.13
13.14 c = C()
13.15 d = D(c)
13.16 -result = d.x()
13.17 +result_42 = d.x()
13.18
13.19 # vim: tabstop=4 expandtab shiftwidth=4
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/tests/failure/call_func_keyword_excess.py Fri May 29 00:18:40 2009 +0200
14.3 @@ -0,0 +1,8 @@
14.4 +#!/usr/bin/env python
14.5 +
14.6 +def g(a, c, b):
14.7 + pass
14.8 +
14.9 +g(1, c=3, b=2, d=4)
14.10 +
14.11 +# vim: tabstop=4 expandtab shiftwidth=4