--- /dev/null
+1st lvl do
+2nd lvl do
+3rd lvl do
+2nd lvl catch
+1st lvl catch
+fin du programme
--- /dev/null
+catch in catch
--- /dev/null
+0
+2
+4
+6
+8
--- /dev/null
+about to abort in A.foo
+catched abort from A.foo
+about to abort in B.bar
+catched the abort from B.bar
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ var x: Int
+
+ fun foo do
+ x = 10
+ abort
+ end
+end
+
+var y
+y = new A(100)
+do
+ y.foo
+catch
+ print y.x
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var x = ""
+do
+ x = "1st lvl do"
+ print x
+ do
+ x = "2nd lvl do"
+ print x
+ do
+ x = "3rd lvl do"
+ print x
+ end
+ abort
+ catch
+ x = "2nd lvl catch"
+ print x
+ abort
+ end
+catch
+ x = "1st lvl catch"
+ print x
+end
+x = "fin du programme"
+print x
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+do
+ abort
+catch
+ do
+ abort
+ catch
+ print "catch in catch"
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+for i in 10.times do
+ do
+ if i.is_even then abort
+ catch
+ print i
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun foo do
+ print "about to abort in A.foo"
+ abort
+ end
+
+ fun test do
+ var b
+ do
+ b = new A
+ foo
+ catch
+ print "catched abort from A.foo"
+ b = new B
+ b.bar
+ end
+ end
+end
+
+class B
+ fun bar do
+ print "about to abort in B.bar"
+ abort
+ end
+
+end
+
+do
+ var a = new A
+ a.test
+catch
+ print "catched the abort from B.bar"
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var x
+do
+ x = 11
+ abort
+catch
+ x = "foo"
+end
+print x