end
# Return a correct bunch of registers
- fun dup_iregs(regs: Sequence[IRegister]): Sequence[IRegister]
+ fun dup_iregs(regs: Sequence[IRegister]): Array[IRegister]
do
var a = new Array[IRegister].with_capacity(regs.length)
for r in regs do
var c = inner_dup_with(d)
if self isa ICodeN then
assert c isa ICodeN
- c.closure_defs = closure_defs
+ var cdecl = closure_defs
+ if cdecl != null then
+ # Duplicate the colsure definitions
+ var cdecl2 = new Array[nullable IClosureDef].with_capacity(cdecl.length)
+ for cd in cdecl do
+ if cd == null then
+ cdecl2.add(null)
+ else
+ var r = cd.result
+ if r != null then r = d.dup_ireg(r)
+ var cd2 = new IClosureDef(d.dup_iregs(cd.params), r)
+ cdecl2.add(cd2)
+ cd.body.dup_seq_to(d, cd2.body)
+ end
+ end
+ c.closure_defs = cdecl2
+ end
end
var r = result
if r != null then c.result = d.dup_ireg(r)
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2008 Jean Privat <jean@pryen.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.
+
+import kernel
+
+class Inline__
+ fun foo
+ !f
+ do
+ f
+ f
+ end
+end
+
+class B
+ var _b: Int
+ redef fun output do _b.output
+end
+
+var a = new Inline__
+a.foo !f do
+ var x = new B(1)
+ var y = 2
+ a.foo !f do
+ x.output
+ y.output
+ x = new B(3)
+ y = 4
+ #alt1#break label l1
+ #alt2#break label l2
+ #alt3#continue label l1
+ #alt4#continue label l2
+ end label l1
+ x.output
+ y.output
+end label l2
+5.output