Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Bump lints, require Dart 3.3 #88

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [3.0.0, dev]
sdk: [3.3.0, dev]
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.10.13-wip

- Require Dart 3.0
- Require Dart 3.3

## 0.10.12

Expand Down
17 changes: 9 additions & 8 deletions lib/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Mapping parseJson(Map map,
if (map.containsKey('mappings') ||
map.containsKey('sources') ||
map.containsKey('names')) {
throw FormatException('map containing "sections" '
throw const FormatException('map containing "sections" '
'cannot contain "mappings", "sources", or "names".');
}
return MultiSectionMapping.fromJson(map['sections'] as List, otherMaps,
Expand Down Expand Up @@ -110,13 +110,13 @@ class MultiSectionMapping extends Mapping {
{/*String|Uri*/ Object? mapUrl}) {
for (var section in sections.cast<Map>()) {
var offset = section['offset'] as Map?;
if (offset == null) throw FormatException('section missing offset');
if (offset == null) throw const FormatException('section missing offset');

var line = offset['line'] as int?;
if (line == null) throw FormatException('offset missing line');
if (line == null) throw const FormatException('offset missing line');

var column = offset['column'] as int?;
if (column == null) throw FormatException('offset missing column');
if (column == null) throw const FormatException('offset missing column');

_lineStart.add(line);
_columnStart.add(column);
Expand All @@ -125,7 +125,8 @@ class MultiSectionMapping extends Mapping {
var map = section['map'] as Map?;

if (url != null && map != null) {
throw FormatException("section can't use both url and map entries");
throw const FormatException(
"section can't use both url and map entries");
} else if (url != null) {
var other = otherMaps?[url];
if (otherMaps == null || other == null) {
Expand All @@ -137,11 +138,11 @@ class MultiSectionMapping extends Mapping {
} else if (map != null) {
_maps.add(parseJson(map, otherMaps: otherMaps, mapUrl: mapUrl));
} else {
throw FormatException('section missing url or map');
throw const FormatException('section missing url or map');
}
}
if (_lineStart.isEmpty) {
throw FormatException('expected at least one section');
throw const FormatException('expected at least one section');
}
}

Expand Down Expand Up @@ -342,7 +343,7 @@ class SingleMapping extends Mapping {
urls.keys.toList(), names.keys.toList(), lines);
}

SingleMapping.fromJson(Map<String, dynamic> map, {mapUrl})
SingleMapping.fromJson(Map<String, dynamic> map, {Object? mapUrl})
: targetUrl = map['file'] as String?,
urls = List<String>.from(map['sources'] as List),
names = List<String>.from((map['names'] as List?) ?? []),
Expand Down
5 changes: 2 additions & 3 deletions lib/src/source_map_span.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ class SourceMapSpan extends SourceSpanBase {
/// If this is `true`, [text] is the value of the identifier.
final bool isIdentifier;

SourceMapSpan(SourceLocation start, SourceLocation end, String text,
{this.isIdentifier = false})
: super(start, end, text);
SourceMapSpan(super.start, super.end, super.text,
{this.isIdentifier = false});

/// Creates a [SourceMapSpan] for an identifier with value [text] starting at
/// [start].
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ description: A library to programmatically manipulate source map files.
repository: https://github.com/dart-lang/source_maps

environment:
sdk: ^3.0.0
sdk: ^3.3.0

dependencies:
source_span: ^1.8.0

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
term_glyph: ^1.2.0
test: ^1.16.0
3 changes: 3 additions & 0 deletions test/parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// ignore_for_file: inference_failure_on_collection_literal
// ignore_for_file: inference_failure_on_instance_creation

import 'dart:convert';

import 'package:source_maps/source_maps.dart';
Expand Down