PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/compiler/asm/liberty_asm_instruction_proxy.e

http://github.com/tybor/Liberty
Specman e | 68 lines | 43 code | 11 blank | 14 comment | 0 complexity | d3489cad6ea07d9331787ded1b70157b MD5 | raw file
 1-- This file is part of Liberty Eiffel.
 2--
 3-- Liberty Eiffel is free software: you can redistribute it and/or modify
 4-- it under the terms of the GNU General Public License as published by
 5-- the Free Software Foundation, version 3 of the License.
 6--
 7-- Liberty Eiffel is distributed in the hope that it will be useful,
 8-- but WITHOUT ANY WARRANTY; without even the implied warranty of
 9-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10-- GNU General Public License for more details.
11--
12-- You should have received a copy of the GNU General Public License
13-- along with Liberty Eiffel.  If not, see <http://www.gnu.org/licenses/>.
14--
15class LIBERTY_ASM_INSTRUCTION_PROXY
16
17inherit
18   LIBERTY_ASM_INSTRUCTION
19      redefine
20         is_equal
21      end
22
23create {LIBERTY_ASM_READER}
24   new, invoke, jump
25
26feature {ANY}
27   is_equal (other: like Current): BOOLEAN is
28      do
29         equal_visitor.start(Current)
30         equal_visitor.confirm(other)
31         Result := equal_visitor.confirmed and then Precursor(other)
32      end
33
34   accept (visitor: LIBERTY_ASM_VISITOR) is
35      local
36         v: LIBERTY_ASM_PROXY_VISITOR
37      do
38         v ::= visitor
39         accepter.call([v])
40      end
41
42feature {}
43   accepter: PROCEDURE[TUPLE[LIBERTY_ASM_PROXY_VISITOR]]
44
45   new (type_id: INTEGER) is
46      do
47         accepter := agent {LIBERTY_ASM_PROXY_VISITOR}.visit_proxy_new(Current, type_id)
48      end
49
50   invoke (method_id, type_id: INTEGER) is
51      do
52         accepter := agent {LIBERTY_ASM_PROXY_VISITOR}.visit_proxy_invoke(Current, method_id, type_id)
53      end
54
55   jump (a_position: INTEGER) is
56      do
57         accepter := agent {LIBERTY_ASM_PROXY_VISITOR}.visit_proxy_jump(Current, a_position)
58      end
59
60   equal_visitor: LIBERTY_ASM_INSTRUCTION_PROXY_EQUAL_VISITOR is
61      once
62         create Result.make
63      end
64
65invariant
66   accepter /= Void
67
68end -- class LIBERTY_ASM_INSTRUCTION_PROXY