Skip to content
Browse files

Resolved merge conflicts.

  • Loading branch information...
2 parents 0c21c6d + a27866a commit 04b569fa98fd1c96d14841b49921c4b6e4e684a6 @tdidriksen 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
46 src/type_checker/textual_bon_type_checker.e
@@ -1166,6 +1166,52 @@ feature -- Type checking, static diagrams
end
end
+ check_feature_arguments(an_element: FEATURE_ARGUMENT_LIST; enclosing_feature: TBON_TC_FEATURE; 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.
+ ]"
+ require
+ enclosing_feature.arguments /= Void
+ local
+ argument: FEATURE_ARGUMENT
+ l_argument: TBON_TC_FEATURE_ARGUMENT
+ t_type: TBON_TC_CLASS_TYPE
+ do
+ Result := True
+ if first_phase then
+ from an_element.start until an_element.after loop
+ argument := an_element.item_for_iteration
+ if argument.type.is_class_type then
+ if attached {TBON_TC_CLASS_TYPE} type_with_name(argument.type.class_type.class_name, formal_type_context) as type then
+ from argument.identifiers.start until argument.identifiers.after
+ loop
+ create l_argument.make (argument.identifiers.item_for_iteration, type)
+ enclosing_feature.arguments.extend (l_argument)
+ end
+ else
+ from argument.identifiers.start until argument.identifiers.after
+ loop
+ create t_type.make (argument.identifiers.item_for_iteration)
+ create l_argument.make (argument.identifiers.item_for_iteration, t_type)
+ enclosing_feature.arguments.extend (l_argument)
+ end
+ unresolved_features := unresolved_features.extended (enclosing_feature)
+ end
+ elseif argument.type.is_formal_generic_name then
+ Result := enclosing_class.has_generic_name (argument.type.formal_generic_name)
+ if not Result then
+
+ end
+ end
+ end
+ elseif second_phase then
+
+ 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
View
24 src/type_checker/types/tbon_tc_class_type.e
@@ -143,12 +143,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 04b569f

Please sign in to comment.
Something went wrong with that request. Please try again.