From e47a5fbaddd0b1402e4fdee41ed3b606eb29edf5 Mon Sep 17 00:00:00 2001 From: Jonathan Worthington Date: Thu, 21 Oct 2010 23:25:13 +0200 Subject: [PATCH] [dotnet] Add DNST::TryCatch and DNST::Throw nodes. --- dotnet/compiler/DNST.pm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dotnet/compiler/DNST.pm b/dotnet/compiler/DNST.pm index a61f339..19ab885 100644 --- a/dotnet/compiler/DNST.pm +++ b/dotnet/compiler/DNST.pm @@ -231,6 +231,36 @@ class DNST::TryFinally is DNST::Node { } } +class DNST::TryCatch is DNST::Node { + has $!exception_type; + has $!exception_var; + + method exception_type($set?) { + if $set { $!exception_type := $set } + $!exception_type + } + + method exception_var($set?) { + if $set { $!exception_var := $set } + $!exception_var + } + + method new(*@children, :$exception_type!, :$exception_var!) { + my $obj := self.CREATE; + $obj.exception_type($exception_type); + $obj.exception_var($exception_var); + $obj.set_children(@children); + $obj; + } +} + +class DNST::Throw is DNST::Node { + method new() { + my $obj := self.CREATE; + $obj; + } +} + class DNST::If is DNST::Node { method new(*@children) { my $obj := self.CREATE;