Boo

code pattern matching: method invocations with arguments

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.8.2, 0.9
  • Fix Version/s: 0.9
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

[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()

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: