Skip to content

CPLAT-17467 Remove usages of .slice to work around a dart2js compiler bug #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 3, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/src/json_schema/json_schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ class JsonSchema {
// Follow JSON Pointer path of fragments if provided.
if (pathUri.fragment.isNotEmpty) {
final List<String> fragments = Uri.parse(pathUri.fragment).pathSegments;
final foundSchema = _recursiveResolvePath(pathUri, fragments.slice(0), baseSchema, refsEncountered);
final foundSchema = _recursiveResolvePath(pathUri, fragments, baseSchema, refsEncountered);
_memomizedResults[currentPair] = foundSchema;
return foundSchema;
}
Expand All @@ -607,7 +607,7 @@ class JsonSchema {
// When there are 2 possible path to be resolve, traverse both paths.
JsonSchema _resolveParallelPaths(
Uri pathUri, // The path being resolved
ListSlice<String> fragments, // A slice of fragments being traversed.
List<String> fragments, // A slice of fragments being traversed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is this comment out of date now?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is this comment out of date now?

JsonSchema schemaWithRef, // A JsonSchema containing a ref.
Set<Uri> refsEncountered, // Refs encountered from schemaWithRef
) {
Expand Down Expand Up @@ -667,7 +667,7 @@ class JsonSchema {
}

JsonSchema _recursiveResolvePath(
Uri pathUri, ListSlice<String> fragments, JsonSchema baseSchema, Set<Uri> refsEncountered,
Uri pathUri, List<String> fragments, JsonSchema baseSchema, Set<Uri> refsEncountered,
{bool skipInitialRefCheck = false}) {
// Set of properties that are ignored when set beside a `$ref`.
final Set<String> consts = Set.of([r'$id', r'$schema', r'$comment']);
Expand Down Expand Up @@ -762,7 +762,7 @@ class JsonSchema {
// If currentSchema has additional values, then traverse both paths to find the result.
if (i + 1 < fragments.length && currentSchema._schemaMap.keys.toSet().difference(consts).length > 1) {
return _resolveParallelPaths(
pathUri, fragments.slice(i, fragments.length - 1), currentSchema, refsEncountered);
pathUri, fragments.sublist(i, fragments.length - 1), currentSchema, refsEncountered);
}

currentSchema = _resolveSchemaWithAccounting(pathUri, currentSchema, refsEncountered);
Expand Down