Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4d1500f

Browse files
committed
Refactoring: Move responsibility to get context name completely to get_context_name
1 parent a4d92de commit 4d1500f

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

source/core/ut_suite_builder.pkb

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -817,26 +817,35 @@ create or replace package body ut_suite_builder is
817817
l_default_context_name t_object_name;
818818
function get_context_name(
819819
a_parent in out nocopy ut_suite,
820-
a_context_names in tt_annotation_texts,
821-
a_start_position binary_integer,
822-
a_end_position binary_integer
820+
a_start_position binary_integer
823821
) return varchar2 is
824822
l_result t_annotation_name;
825823
l_found boolean;
824+
l_end_position binary_integer;
826825
l_annotation_pos binary_integer;
826+
l_context_names tt_annotation_texts;
827827
begin
828-
l_annotation_pos := a_context_names.first;
829-
while l_annotation_pos is not null loop
830-
if l_annotation_pos > a_start_position and l_annotation_pos < a_end_position then
831-
if l_found then
832-
add_annotation_ignored_warning(a_parent, gc_name,'Duplicate annotation %%%.', l_annotation_pos);
833-
else
834-
l_result := a_context_names(l_annotation_pos);
835-
end if;
836-
l_found := true;
837-
end if;
838-
l_annotation_pos := a_context_names.next(l_annotation_pos);
839-
end loop;
828+
if a_annotations.by_name.exists(gc_name) then
829+
l_context_names := a_annotations.by_name( gc_name );
830+
l_end_position :=
831+
least(
832+
coalesce( get_endcontext_position(a_start_position, a_annotations.by_name), a_annotations.by_line.last ),
833+
coalesce( a_annotations.by_name(gc_context).next(a_start_position), a_annotations.by_line.last )
834+
);
835+
l_annotation_pos := l_context_names.first;
836+
837+
while l_annotation_pos is not null loop
838+
if l_annotation_pos > a_start_position and l_annotation_pos < l_end_position then
839+
if l_found then
840+
add_annotation_ignored_warning(a_parent, gc_name,'Duplicate annotation %%%.', l_annotation_pos);
841+
else
842+
l_result := l_context_names(l_annotation_pos);
843+
end if;
844+
l_found := true;
845+
end if;
846+
l_annotation_pos := l_context_names.next(l_annotation_pos);
847+
end loop;
848+
end if;
840849
return l_result;
841850
end;
842851
begin
@@ -852,18 +861,8 @@ create or replace package body ut_suite_builder is
852861
l_context_name := null;
853862
l_end_context_pos := get_endcontext_position(l_context_pos, a_annotations.by_name );
854863
l_next_context_pos := a_annotations.by_name(gc_context).next(l_context_pos);
855-
if a_annotations.by_name.exists(gc_name) then
856-
l_context_name :=
857-
get_context_name(
858-
a_parent,
859-
a_annotations.by_name( gc_name ),
860-
l_context_pos,
861-
least(
862-
coalesce( l_end_context_pos, a_annotations.by_line.last ),
863-
coalesce( l_next_context_pos, a_annotations.by_line.last )
864-
)
865-
);
866-
end if;
864+
l_context_name := get_context_name(a_parent, l_context_pos);
865+
867866
if not regexp_like( l_context_name, '^(\w|[$#])+$' ) or l_context_name is null then
868867
if not regexp_like( l_context_name, '^(\w|[$#])+$' ) then
869868
a_parent.put_warning(

0 commit comments

Comments
 (0)