Permalink
Browse files

First draft of feature arguments and conforms to.

  • Loading branch information...
1 parent 216a460 commit 1857fc3b716cab40fc58a7c95a47ded651762cc4 Sune Alkærsig committed Apr 17, 2012
View
1 src/type_checker/tbon_tc_error.e
@@ -36,6 +36,7 @@ feature -- Access
feature -- Error codes
err_code_ancestor_does_not_exist,
+ err_code_argument_type_does_not_exist,
err_code_class_already_in_cluster,
err_code_class_does_not_exist,
err_code_class_exists,
View
11 src/type_checker/tbon_tc_text_items.e
@@ -39,6 +39,17 @@ feature -- Error messages
Result.append_string (" does not exist.")
end
+ err_argument_type_does_not_exist(an_argument_name, a_feature_name, a_class_name: STRING): STRING
+ do
+ Result := "Type of argument "
+ Result.append_string (an_argument_name.string)
+ Result.append_string (" in feature ")
+ Result.append_string (a_feature_name.string)
+ Result.append_string (" in class ")
+ Result.append_string (a_class_name.string)
+ Result.append_string (" could not be found.")
+ end
+
err_class_already_in_cluster (a_name: STRING): STRING
do
Result := "Error defining cluster "
View
39 src/type_checker/textual_bon_type_checker.e
@@ -1066,6 +1066,43 @@ feature -- Type checking, static diagrams
end
end
+ check_feature_arguments(an_element: FEATURE_ARGUMENT_LIST; enclosing_feature: FEATURE_SPECIFICATION; enclosing_class: TBON_TC_CLASS_TYPE): BOOLEAN
+ note
+ rule: "[
+ In an environment where all arguments are OK,
+ and if the feature is redefined all arguments conform to its precursors,
+ `an_element' is OK.
+ ]"
+ local
+ l_argument: FEATURE_ARGUMENT
+ l_string_list: STRING_LIST
+ do
+ Result := True
+ if enclosing_feature.has_arguments then
+ if first_phase then
+ from an_element.start until an_element.after loop
+ if an_element.item_for_iteration.identifiers.item_for_iteration.count > 1 then
+ from an_element.item_for_iteration.identifiers.start until an_element.item_for_iteration.identifiers.after loop
+ create l_string_list.make_list (an_element.item_for_iteration.identifiers.item_for_iteration)
+ create l_argument.make (l_string_list, an_element.item_for_iteration.type)
+ an_element.put_last (l_argument)
+ end
+ an_element.remove_at
+ else
+ an_element.forth
+ end
+ end
+ Result := an_element.for_all (agent (argument: FEATURE_ARGUMENT): BOOLEAN
+ do
+
+ end
+ )
+ elseif second_phase then
+
+ end
+ end
+ end
+
check_feature_clause (an_element: FEATURE_CLAUSE; enclosing_class: TBON_TC_CLASS_TYPE): BOOLEAN
-- Does `an_element' type check as a type FEATURE_CLAUSE?
note
@@ -1110,7 +1147,7 @@ feature -- Type checking, static diagrams
and the type of the feature is in the environment,
and all feature arguments are OK,
and if renamed is renamed consistently,
-
+
]"
do
if then
View
24 src/type_checker/types/tbon_tc_class_type.e
@@ -124,12 +124,26 @@ feature -- Status report
conforms_to (other: TBON_TC_TYPE): BOOLEAN
-- Does `Current' conform to `other'?
local
- class_type: TBON_TC_CLASS_TYPE
+ l_ancestors: like Current.ancestors
do
- class_type ?= other
-
- if class_type /= Void then
-
+ if Current |=| other then
+ Result := True
+ elseif not attached {TBON_TC_CLUSTER_TYPE} other then
+ l_ancestors := Current.ancestors
+ Result := l_ancestors.exists (
+ agent (type: TBON_TC_CLASS_TYPE; l_other: TBON_TC_TYPE): BOOLEAN
+ do
+ Result := type |=| l_other
+ end (?, other)
+ )
+ if not Result then
+ Result := l_ancestors.for_all (
+ agent (type: TBON_TC_CLASS_TYPE; l_other: TBON_TC_TYPE): BOOLEAN
+ do
+ Result := type.conforms_to (l_other)
+ end (?, other)
+ )
+ end
else
Result := False
end

0 comments on commit 1857fc3

Please sign in to comment.