Navigation Menu

Skip to content

Commit

Permalink
Added more predefined types in ET_UNIVERSE.
Browse files Browse the repository at this point in the history
  • Loading branch information
ebezault committed Apr 8, 2016
1 parent 944bacd commit 8653f42
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
18 changes: 18 additions & 0 deletions library/tools/src/eiffel/ast/group/et_universe.e
Expand Up @@ -883,12 +883,18 @@ feature -- Kernel types
type_any_type: ET_CLASS_TYPE
-- Class type "TYPE [ANY]"

type_type_any_type: ET_CLASS_TYPE
-- Class type "TYPE [TYPE [ANY]]"

type_detachable_any_type: ET_CLASS_TYPE
-- Class type "TYPE [detachable ANY]"

detachable_type_detachable_any_type: ET_CLASS_TYPE
-- Class type "detachable TYPE [detachable ANY]"

type_detachable_like_current_type: ET_CLASS_TYPE
-- Class type "TYPE [detachable like Current]"

detachable_type_exception_type: ET_CLASS_TYPE
-- Class type "detachable TYPE [EXCEPTION]"

Expand Down Expand Up @@ -1534,12 +1540,20 @@ feature -- Kernel types
create l_parameters.make_with_capacity (1)
l_parameters.put_first (any_type)
create type_any_type.make_generic (Void, l_name, l_parameters, l_master_class)
-- "TYPE [TYPE [ANY]]"
create l_parameters.make_with_capacity (1)
l_parameters.put_first (type_any_type)
create type_type_any_type.make_generic (Void, l_name, l_parameters, l_master_class)
-- "TYPE [detachable ANY]"
create l_parameters.make_with_capacity (1)
l_parameters.put_first (detachable_any_type)
create type_detachable_any_type.make_generic (Void, l_name, l_parameters, l_master_class)
-- "detachable TYPE [detachable ANY]"
create detachable_type_detachable_any_type.make_generic (tokens.detachable_keyword, l_name, l_parameters, l_master_class)
-- "TYPE [detachable like Current]"
create l_parameters.make_with_capacity (1)
l_parameters.put_first (tokens.detachable_like_current)
create type_detachable_like_current_type.make_generic (Void, l_name, l_parameters, l_master_class)
-- "detachable TYPE [EXCEPTION]"
create l_parameters.make_with_capacity (1)
l_parameters.put_first (exception_type)
Expand Down Expand Up @@ -1659,7 +1673,9 @@ feature -- Kernel types
system_object_parents := tokens.unknown_parents
system_string_type := tokens.unknown_class_type
type_any_type := tokens.unknown_generic_class_type
type_type_any_type := tokens.unknown_generic_class_type
type_detachable_any_type := tokens.unknown_generic_class_type
type_detachable_like_current_type := tokens.unknown_generic_class_type
detachable_type_exception_type := tokens.unknown_generic_class_type
type_detachable_exception_type := tokens.unknown_generic_class_type
detachable_type_detachable_any_type := tokens.unknown_generic_class_type
Expand Down Expand Up @@ -2595,7 +2611,9 @@ invariant
tuple_like_current_type_not_void: tuple_like_current_type /= Void
tuple_actual_parameters_not_void: unfolded_empty_tuple_actual_parameters /= Void
type_any_type_not_void: type_any_type /= Void
type_type_any_type_not_void: type_type_any_type /= Void
type_detachable_any_type_not_void: type_detachable_any_type /= Void
type_detachable_like_current_type_not_void: type_detachable_like_current_type /= Void
detachable_type_exception_type_not_void: detachable_type_exception_type /= Void
type_detachable_exception_type_not_void: type_detachable_exception_type /= Void
detachable_type_detachable_any_type_not_void: detachable_type_detachable_any_type /= Void
Expand Down
29 changes: 7 additions & 22 deletions library/tools/src/eiffel/compilation/et_builtin_feature_checker.e
Expand Up @@ -204,8 +204,6 @@ feature {NONE} -- Built-in validity
a_feature_not_void: a_feature /= Void
local
l_formals: detachable ET_FORMAL_ARGUMENT_LIST
l_type_detachable_like_current: ET_CLASS_TYPE
l_parameters: ET_ACTUAL_PARAMETER_LIST
do
-- List function names first, then procedure names.
if a_feature.name.same_feature_name (tokens.twin_feature_name) then
Expand Down Expand Up @@ -298,18 +296,15 @@ feature {NONE} -- Built-in validity
end
elseif a_feature.name.same_feature_name (tokens.generating_type_feature_name) then
a_feature.set_builtin_code (tokens.builtin_any_feature (tokens.builtin_any_generating_type))
create l_parameters.make_with_capacity (1)
l_parameters.put_first (tokens.detachable_like_current)
create l_type_detachable_like_current.make_generic (Void, tokens.type_class_name, l_parameters, current_universe.type_any_type.named_base_class)
l_formals := a_feature.arguments
if l_formals /= Void and then l_formals.count /= 0 then
-- The signature should be 'generating_type: TYPE [detachable like Current]'.
set_fatal_error
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, l_type_detachable_like_current)
elseif not a_feature.type.same_syntactical_type (l_type_detachable_like_current, current_class, current_class) then
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, current_universe.type_detachable_like_current_type)
elseif not a_feature.type.same_syntactical_type (current_universe.type_detachable_like_current_type, current_class, current_class) then
-- The signature should be 'generating_type: TYPE [detachable like Current]'.
set_fatal_error
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, l_type_detachable_like_current)
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, current_universe.type_detachable_like_current_type)
end
elseif a_feature.name.same_feature_name (tokens.tagged_out_feature_name) then
a_feature.set_builtin_code (tokens.builtin_any_feature (tokens.builtin_any_tagged_out))
Expand Down Expand Up @@ -390,8 +385,6 @@ feature {NONE} -- Built-in validity
a_feature_not_void: a_feature /= Void
local
l_formals: detachable ET_FORMAL_ARGUMENT_LIST
l_type_type_any: ET_CLASS_TYPE
l_parameters: ET_ACTUAL_PARAMETER_LIST
l_formal_parameter: ET_FORMAL_PARAMETER_TYPE
do
-- List function names first, then procedure names.
Expand Down Expand Up @@ -566,18 +559,15 @@ feature {NONE} -- Built-in validity
end
elseif a_feature.name.same_feature_name (tokens.generating_type_feature_name) then
a_feature.set_builtin_code (tokens.builtin_type_feature (tokens.builtin_type_generating_type))
create l_parameters.make_with_capacity (1)
l_parameters.put_first (current_universe.type_any_type)
create l_type_type_any.make_generic (Void, tokens.type_class_name, l_parameters, current_universe.type_any_type.named_base_class)
l_formals := a_feature.arguments
if l_formals /= Void and then l_formals.count /= 0 then
-- The signature should be 'generating_type: TYPE [TYPE [ANY]]'.
set_fatal_error
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, l_type_type_any)
elseif not a_feature.type.same_syntactical_type (l_type_type_any, current_class, current_class) then
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, current_universe.type_type_any_type)
elseif not a_feature.type.same_syntactical_type (current_universe.type_type_any_type, current_class, current_class) then
-- The signature should be 'generating_type: TYPE [TYPE [ANY]]'.
set_fatal_error
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, l_type_type_any)
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, current_universe.type_type_any_type)
end
elseif a_feature.name.same_feature_name (tokens.generic_parameter_count_feature_name) then
a_feature.set_builtin_code (tokens.builtin_type_feature (tokens.builtin_type_generic_parameter_count))
Expand Down Expand Up @@ -3727,8 +3717,6 @@ feature {NONE} -- Built-in validity
require
a_feature_not_void: a_feature /= Void
local
l_type_type_any: ET_CLASS_TYPE
l_parameters: ET_ACTUAL_PARAMETER_LIST
l_formals: detachable ET_FORMAL_ARGUMENT_LIST
l_formal_parameter: ET_FORMAL_PARAMETER_TYPE
do
Expand Down Expand Up @@ -4101,11 +4089,8 @@ feature {NONE} -- Built-in validity
elseif a_feature.name.same_feature_name (tokens.generating_type_feature_name) then
-- 'TYPE.generating_type' should be a function.
a_feature.set_builtin_code (tokens.builtin_type_feature (tokens.builtin_type_generating_type))
create l_parameters.make_with_capacity (1)
l_parameters.put_first (current_universe.type_any_type)
create l_type_type_any.make_generic (Void, tokens.type_class_name, l_parameters, current_universe.type_any_type.named_base_class)
set_fatal_error
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, l_type_type_any)
error_handler.report_gvkbs0a_error (current_class, a_feature, Void, current_universe.type_type_any_type)
elseif a_feature.name.same_feature_name (tokens.generic_parameter_count_feature_name) then
-- 'TYPE.generic_parameter_count' should be a function.
a_feature.set_builtin_code (tokens.builtin_type_feature (tokens.builtin_type_generic_parameter_count))
Expand Down

0 comments on commit 8653f42

Please sign in to comment.