Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 19bc1a9

Browse files
Remove "is x among y" syntax for codeunits
This overload was ambiguous and could never be called because the chars form was always chosen instead.
1 parent 390fdd4 commit 19bc1a9

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

libscript/src/codeunit.lcb

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ public foreign handler MCCodeunitStoreCodeunitRangeOf(in Value as String, in Sta
2929

3030
public foreign handler MCCodeunitEvalNumberOfCodeunitsIn(in Target as String, out Count as LCUIndex) returns nothing binds to "<builtin>"
3131

32-
public foreign handler MCCodeunitEvalIsAmongTheCodeunitsOf(in Needle as String, in Target as String, out Value as CBool) returns nothing binds to "<builtin>"
33-
3432
public foreign handler MCCodeunitStoreBeforeCodeunitOf(in Value as String, in Index as LCIndex, inout Target as String) returns nothing binds to "<builtin>"
3533
public foreign handler MCCodeunitStoreAfterCodeunitOf(in Value as String, in Index as LCIndex, inout Target as String) returns nothing binds to "<builtin>"
3634

@@ -42,7 +40,7 @@ public foreign handler MCCodeunitEvalContains(in Source as String, in Needle as
4240
public foreign handler MCCodeunitEvalBeginsWith(in Source as String, in Prefix as String, out Result as CBool) returns nothing binds to "<builtin>"
4341
public foreign handler MCCodeunitEvalEndsWith(in Source as String, in Suffix as String, out Result as CBool) returns nothing binds to "<builtin>"
4442

45-
public foreign handler MCCodeunitRepeatForEachCodeunit(inout Iterator as optional Pointer, inout Iterand as String, in Container as String) returns CBool binds to "<builtin>"
43+
public foreign handler MCCodeunitRepeatForEachCodeunit(inout Iterator as optional Pointer, inout Iterand as optional String, in Container as String) returns CBool binds to "<builtin>"
4644

4745
public foreign handler MCCodeunitFetchFirstCodeunitOf(in Target as String, out Value as String) returns nothing binds to "<builtin>"
4846
public foreign handler MCCodeunitStoreFirstCodeunitOf(in Value as String, inout Target as String) returns nothing binds to "<builtin>"
@@ -294,27 +292,6 @@ end syntax
294292

295293
--
296294

297-
/**
298-
Summary: Determines whether <Needle> is in <Target>.
299-
Needle: An expression which evaluates to a codeunit.
300-
Target: An expression which evaluates to a string.
301-
302-
Returns: True if <Needle> is among the codeunits of <Target>, and false otherwise.
303-
304-
Description:
305-
>*Note:* It is an error if <Needle> evaluates to a string consisting of more than one codeunit.
306-
307-
Tags: Strings
308-
*/
309-
310-
syntax CodeunitIsInString is neutral binary operator with comparison precedence
311-
<Needle: Expression> "is" "in" <Source: Expression>
312-
begin
313-
MCCodeunitEvalIsAmongTheCodeunitsOf(Needle, Source, output)
314-
end syntax
315-
316-
--
317-
318295
/**
319296
Summary: Finds the first or last occurrence of <Needle> within <Target>
320297

libscript/src/module-codeunit.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,6 @@ extern "C" MC_DLLEXPORT_DEF void MCCodeunitEvalNumberOfCodeunitsIn(MCStringRef p
2323
r_output = MCStringGetLength(p_target);
2424
}
2525

26-
extern "C" MC_DLLEXPORT_DEF void MCCodeunitEvalIsAmongTheCodeunitsOf(MCStringRef p_needle, MCStringRef p_target, bool& r_output)
27-
{
28-
// Error if there is more than one char in needle.
29-
if (MCStringGetLength(p_needle) != 1)
30-
{
31-
MCErrorCreateAndThrow(kMCGenericErrorTypeInfo, "reason", MCSTR("needle must be a single char"), nil);
32-
return;
33-
}
34-
35-
uindex_t t_dummy;
36-
r_output = MCStringFirstIndexOfChar(p_target, MCStringGetCodepointAtIndex(p_needle, 0), 0, kMCStringOptionCompareExact, t_dummy);
37-
}
38-
3926
extern "C" MC_DLLEXPORT_DEF void MCCodeunitFetchCodeunitRangeOf(index_t p_start, index_t p_finish, MCStringRef p_target, MCStringRef& r_output)
4027
{
4128
uindex_t t_start, t_count;

0 commit comments

Comments
 (0)