/src/tools/compiler/liberty_compiler.e
Specman e | 95 lines | 62 code | 16 blank | 17 comment | 1 complexity | 9697d9f446de8d6c042ba33e16b1c6ff 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_COMPILER 16 17create {LIBERTYC} 18 make 19 20feature {ANY} 21 root_type: LIBERTY_ACTUAL_TYPE 22 root_feature_name: LIBERTY_FEATURE_NAME 23 root_feature: LIBERTY_FEATURE_DEFINITION 24 25 check_level: LIBERTY_MAIN_CHECK_LEVEL 26 is_debug: BOOLEAN 27 28feature {} 29 all_types: SET[LIBERTY_ACTUAL_TYPE] 30 31feature {LIBERTYC} 32 compile_classes is 33 -- Compile all the classes used by the program, if they need rebuilding. 34 do 35 36 end 37 38 finalize is 39 -- Builds (links) the final executable. 40 -- Also adds specific runtime frameworks, such as a tailored GC etc. 41 do 42 end 43 44feature {} 45 make (a_universe: like universe; a_root_type: like root_type; a_root_feature_name: like root_feature_name; 46 a_check_level: like check_level; a_debug: like is_debug) is 47 require 48 a_universe /= Void 49 a_root_type /= Void 50 a_root_feature_name /= Void 51 do 52 universe := a_universe 53 54 check_level := a_check_level 55 is_debug := a_debug 56 57 root_type := a_root_type 58 root_feature_name := a_root_feature_name 59 60 ensure_built(a_root_type) 61 if not a_root_type.has_feature(a_root_feature_name) then 62 std_error.put_string("Unknown feature ") 63 std_error.put_string(a_root_feature_name.full_name) 64 std_error.put_string(" in type ") 65 std_error.put_line(a_root_type.full_name) 66 die_with_code(1) 67 end 68 root_feature := a_root_type.feature_definition(a_root_feature_name) 69 70 create {HASH_SET[LIBERTY_ACTUAL_TYPE]} all_types.make 71 all_types.add(root_type) 72 ensure 73 universe = a_universe 74 check_level = a_check_level 75 is_debug = a_debug 76 root_type = a_root_type 77 root_feature_name = a_root_feature_name 78 end 79 80 universe: LIBERTY_UNIVERSE 81 82 ensure_built (a_type: LIBERTY_ACTUAL_TYPE) is 83 do 84 universe.build_types(root_type, root_feature_name, a_type) 85 end 86 87invariant 88 universe /= Void 89 root_type /= Void 90 root_feature_name /= Void 91 root_feature /= Void 92 all_types /= Void 93 all_types.fast_has(root_type) 94 95end -- class LIBERTY_COMPILER