Skip to content
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

Use FastHash on Piece. #1598

Merged
merged 1 commit into from
Nov 13, 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
File renamed without changes.
5 changes: 3 additions & 2 deletions lib/src/piece/piece.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

import '../back_end/code_writer.dart';
import '../fast_hash.dart';
import '../profile.dart';

typedef Constrain = void Function(Piece other, State constrainedState);
Expand All @@ -14,7 +15,7 @@ typedef Constrain = void Function(Piece other, State constrainedState);
/// roughly follows the AST but includes comments and is optimized for
/// formatting and line splitting. The final output is then determined by
/// deciding which pieces split and how.
abstract base class Piece {
abstract base class Piece with FastHash {
/// The ordered list of all possible ways this piece could split.
///
/// Piece subclasses should override this if they support being split in
Expand Down Expand Up @@ -190,7 +191,7 @@ abstract base class Piece {
String get debugName => runtimeType.toString().replaceAll('Piece', '');

@override
String toString() => '$debugName${_pinnedState ?? ''}';
String toString() => '$debugName$id${_pinnedState ?? ''}';
}

/// A state that a piece can be in.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/short/chunk.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// 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.
import '../fast_hash.dart';
import '../profile.dart';
import 'fast_hash.dart';
import 'marking_scheme.dart';
import 'nesting_level.dart';
import 'rule/rule.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/short/nesting_level.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// 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.

import 'fast_hash.dart';
import '../fast_hash.dart';
import 'marking_scheme.dart';

/// A single level of expression nesting.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/short/rule/rule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// BSD-style license that can be found in the LICENSE file.

import '../../constants.dart';
import '../../fast_hash.dart';
import '../../profile.dart';
import '../chunk.dart';
import '../fast_hash.dart';

/// A constraint that determines the different ways a related set of chunks may
/// be split.
Expand Down