Issue Details (XML | Word | Printable)

Key: BOO-1110
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Rodrigo B. de Oliveira
Reporter: Rodrigo B. de Oliveira
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

code pattern matching: method invocations with arguments

Created: 06/Jan/09 07:47 PM   Updated: 22/Jan/09 09:22 AM   Resolved: 06/Jan/09 07:50 PM
Return to search
Component/s: None
Affects Version/s: 0.8.2, 0.9
Fix Version/s: 0.9

Time Tracking:
Not Specified


 Description  « Hide
[Test]
	def TestNoArgInvocationPatternMatchesAnyInvocation():
		assert methodName([| foo() |]) == "foo"
		assert methodName([| bar(42) |]) == "bar"

	[Test]
	def TestInvocationPatternWithArguments():
		assert delegateMethod([| ThreadStart(null, __addressof__(foo)) |]) == "foo"

	[Test]
	[ExpectedException(MatchError)]
	def TestInvocationPatternWithArgumentsMismatch():
		delegateMethod([| ThreadStart(null) |])

	def delegateMethod(code as Expression):
		match code:
			case [| $type(null, __addressof__($method)) |]:
				return method.ToString()

	def methodName(code as Expression):
		match code:
			case [| $name() |]:
				return name.ToString()


There are no comments yet on this issue.