Add test-cases for forward arguments and endless methods

This commit is contained in:
Arthur Baars
2021-10-12 17:32:01 +02:00
parent e44064cda7
commit 0dc3ea5ed1
4 changed files with 76 additions and 0 deletions

View File

@@ -611,6 +611,50 @@ calls/calls.rb:
# 320| getReceiver: [Self] self
# 320| getAnOperand/getArgument/getRightOperand: [IntegerLiteral] 1
# 320| getAnOperand/getRightOperand: [IntegerLiteral] 2
# 323| getStmt: [Method] foo
# 323| getStmt: [MethodCall] call to bar
# 323| getReceiver: [Self] self
# 324| getStmt: [Method] foo
# 324| getStmt: [MethodCall] call to bar
# 324| getReceiver: [Self] self
# 325| getStmt: [Method] foo
# 325| getParameter: [SimpleParameter] x
# 325| getDefiningAccess: [LocalVariableAccess] x
# 325| getStmt: [MethodCall] call to bar
# 325| getReceiver: [Self] self
# 326| getStmt: [SingletonMethod] foo
# 326| getObject: [ConstantReadAccess] Object
# 326| getStmt: [MethodCall] call to bar
# 326| getReceiver: [Self] self
# 327| getStmt: [SingletonMethod] foo
# 327| getObject: [ConstantReadAccess] Object
# 327| getParameter: [SimpleParameter] x
# 327| getDefiningAccess: [LocalVariableAccess] x
# 327| getStmt: [MethodCall] call to bar
# 327| getReceiver: [Self] self
# 328| getStmt: [Method] foo
# 328| getStmt: [RescueModifierExpr] ... rescue ...
# 328| getBody: [MethodCall] call to bar
# 328| getReceiver: [Self] self
# 328| getHandler: [ParenthesizedExpr] ( ... )
# 328| getStmt: [MethodCall] call to print
# 328| getReceiver: [Self] self
# 328| getArgument: [StringLiteral] "error"
# 328| getComponent: [StringTextComponent] error
# 331| getStmt: [Method] foo
# 331| getParameter: [ForwardParameter] ...
# 332| getStmt: [SuperCall] call to super
# 332| getArgument: [ForwardedArguments] ...
# 335| getStmt: [Method] foo
# 335| getParameter: [SimpleParameter] a
# 335| getDefiningAccess: [LocalVariableAccess] a
# 335| getParameter: [SimpleParameter] b
# 335| getDefiningAccess: [LocalVariableAccess] b
# 335| getParameter: [ForwardParameter] ...
# 336| getStmt: [MethodCall] call to bar
# 336| getReceiver: [Self] self
# 336| getArgument: [LocalVariableAccess] b
# 336| getArgument: [ForwardedArguments] ...
control/cases.rb:
# 1| [Toplevel] cases.rb
# 2| getStmt: [AssignExpr] ... = ...

View File

@@ -55,6 +55,7 @@
| calls/calls.rb:320:9:320:9 | __synth__1 | 0 |
| calls/calls.rb:320:31:320:31 | 1 | 1 |
| calls/calls.rb:320:37:320:37 | 2 | 2 |
| calls/calls.rb:328:31:328:37 | "error" | error |
| constants/constants.rb:3:19:3:27 | "const_a" | const_a |
| constants/constants.rb:6:15:6:23 | "const_b" | const_b |
| constants/constants.rb:17:12:17:18 | "Hello" | Hello |

View File

@@ -86,6 +86,10 @@ callsWithArguments
| calls.rb:320:1:320:32 | call to []= | []= | 4 | calls.rb:320:34:320:35 | __synth__4 |
| calls.rb:320:21:320:31 | ... + ... | + | 0 | calls.rb:320:31:320:31 | 1 |
| calls.rb:320:34:320:35 | ... * ... | * | 0 | calls.rb:320:37:320:37 | 2 |
| calls.rb:328:25:328:37 | call to print | print | 0 | calls.rb:328:31:328:37 | "error" |
| calls.rb:332:3:332:12 | call to super | super | 0 | calls.rb:332:9:332:11 | ... |
| calls.rb:336:3:336:13 | call to bar | bar | 0 | calls.rb:336:7:336:7 | b |
| calls.rb:336:3:336:13 | call to bar | bar | 1 | calls.rb:336:10:336:12 | ... |
callsWithReceiver
| calls.rb:2:1:2:5 | call to foo | calls.rb:2:1:2:5 | self |
| calls.rb:5:1:5:10 | call to bar | calls.rb:5:1:5:3 | Foo |
@@ -316,6 +320,14 @@ callsWithReceiver
| calls.rb:320:21:320:27 | call to boo | calls.rb:320:21:320:23 | call to foo |
| calls.rb:320:21:320:31 | ... + ... | calls.rb:320:21:320:27 | call to boo |
| calls.rb:320:34:320:35 | ... * ... | calls.rb:320:1:320:32 | call to [] |
| calls.rb:323:11:323:13 | call to bar | calls.rb:323:11:323:13 | self |
| calls.rb:324:13:324:15 | call to bar | calls.rb:324:13:324:15 | self |
| calls.rb:325:14:325:16 | call to bar | calls.rb:325:14:325:16 | self |
| calls.rb:326:18:326:20 | call to bar | calls.rb:326:18:326:20 | self |
| calls.rb:327:22:327:24 | call to bar | calls.rb:327:22:327:24 | self |
| calls.rb:328:13:328:15 | call to bar | calls.rb:328:13:328:15 | self |
| calls.rb:328:25:328:37 | call to print | calls.rb:328:25:328:37 | self |
| calls.rb:336:3:336:13 | call to bar | calls.rb:336:3:336:13 | self |
callsWithBlock
| calls.rb:17:1:17:17 | call to foo | calls.rb:17:5:17:17 | { ... } |
| calls.rb:20:1:22:3 | call to foo | calls.rb:20:5:22:3 | do ... end |
@@ -339,6 +351,7 @@ superCalls
| calls.rb:292:5:292:30 | call to super |
| calls.rb:293:5:293:33 | call to super |
| calls.rb:305:5:305:9 | call to super |
| calls.rb:332:3:332:12 | call to super |
superCallsWithArguments
| calls.rb:288:5:288:16 | call to super | 0 | calls.rb:288:11:288:16 | "blah" |
| calls.rb:289:5:289:17 | call to super | 0 | calls.rb:289:11:289:11 | 1 |
@@ -348,6 +361,7 @@ superCallsWithArguments
| calls.rb:292:5:292:30 | call to super | 1 | calls.rb:292:14:292:14 | 5 |
| calls.rb:293:5:293:33 | call to super | 0 | calls.rb:293:11:293:11 | 6 |
| calls.rb:293:5:293:33 | call to super | 1 | calls.rb:293:14:293:14 | 7 |
| calls.rb:332:3:332:12 | call to super | 0 | calls.rb:332:9:332:11 | ... |
superCallsWithBlock
| calls.rb:290:5:290:23 | call to super | calls.rb:290:11:290:23 | { ... } |
| calls.rb:291:5:291:26 | call to super | calls.rb:291:11:291:26 | do ... end |

View File

@@ -318,3 +318,20 @@ a, *foo[5] = [1, 2, 3]
self.count += 1
foo[0] += 1
foo.bar[0, foo.baz, foo.boo + 1] *= 2
# endless method definitions
def foo = bar
def foo() = bar
def foo(x) = bar
def Object.foo = bar
def Object.foo (x) = bar
def foo() = bar rescue (print "error")
# forward parameter and forwarded arguments
def foo(...)
super(...)
end
def foo(a, b, ...)
bar(b, ...)
end