Enable analysis for all of dart:ui (flutter/engine#34988)

This commit is contained in:
Michael Goderbauer
2022-07-28 22:29:03 -07:00
committed by GitHub
parent 3ddada0be5
commit f6d473bbd7
5 changed files with 17 additions and 25 deletions

View File

@@ -29,6 +29,8 @@ analyzer:
import_internal_library: ignore
# Turned off until null-safe rollout is complete.
unnecessary_null_comparison: ignore
# TODO(goderbauer): remove when https://github.com/dart-lang/sdk/issues/49563 is fixed.
ffi_native_unexpected_number_of_parameters: ignore
linter:
rules:

View File

@@ -30,7 +30,6 @@ function follow_links() (
SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")")
SRC_DIR="$(cd "$SCRIPT_DIR/../.."; pwd -P)"
FLUTTER_DIR="$SRC_DIR/flutter"
SKY_ENGINE_DIR="$SRC_DIR/out/host_debug_unopt/gen/dart-pkg/sky_engine"
DART_BIN="$SRC_DIR/out/host_debug_unopt/dart-sdk/bin"
DART="$DART_BIN/dart"
@@ -47,8 +46,7 @@ echo "Using dart from $DART_BIN"
"$DART" --version
echo ""
(cd $SKY_ENGINE_DIR && "$DART" pub get --offline)
"$DART" analyze "$SKY_ENGINE_DIR/lib/ui/ui.dart"
"$DART" analyze "$FLUTTER_DIR/lib/ui"
"$DART" analyze "$FLUTTER_DIR/lib/spirv"

View File

@@ -1720,13 +1720,13 @@ class RSTransform {
/// The `translateX` and `translateY` parameters give the coordinate of the
/// offset by which to translate.
///
/// This constructor computes the arguments of the [new RSTransform]
/// This constructor computes the arguments of the [RSTransform.new]
/// constructor and then defers to that constructor to actually create the
/// object. If many [RSTransform] objects are being created and there is a way
/// to factor out the computations of the sine and cosine of the rotation
/// (which are computed each time this constructor is called) and reuse them
/// over multiple [RSTransform] objects, it may be more efficient to directly
/// use the more direct [new RSTransform] constructor instead.
/// use the more direct [RSTransform.new] constructor instead.
factory RSTransform.fromComponents({
required double rotation,
required double scale,

View File

@@ -3522,7 +3522,7 @@ class _ErodeImageFilter implements ImageFilter {
}
@override
int get hashCode => hashValues(radiusX, radiusY);
int get hashCode => Object.hash(radiusX, radiusY);
}
class _ComposeImageFilter implements ImageFilter {
@@ -4042,7 +4042,7 @@ class FragmentProgram extends NativeFieldWrapperClass1 {
/// compiler. The constructed object should then be reused via the [shader]
/// method to create [Shader] objects that can be used by [Shader.paint].
static Future<FragmentProgram> fromAsset(String assetKey) {
FragmentProgram? program = _shaderRegistry[assetKey]?.target;
final FragmentProgram? program = _shaderRegistry[assetKey]?.target;
if (program != null) {
return Future<FragmentProgram>.value(program);
}
@@ -4061,13 +4061,6 @@ class FragmentProgram extends NativeFieldWrapperClass1 {
static Map<String, WeakReference<FragmentProgram>> _shaderRegistry =
<String, WeakReference<FragmentProgram>>{};
FragmentProgram._() {
assert(
false,
'FragmentProgram should only be initialized via "fromAsset".',
);
}
@pragma('vm:entry-point')
FragmentProgram._fromAsset(String assetKey) {
_constructor();
@@ -4093,7 +4086,7 @@ class FragmentProgram extends NativeFieldWrapperClass1 {
return;
}
final result = program._initFromAsset(assetKey);
final String result = program._initFromAsset(assetKey);
if (result.isNotEmpty) {
throw result;
}
@@ -4164,9 +4157,7 @@ class FragmentProgram extends NativeFieldWrapperClass1 {
Float32List? floatUniforms,
List<ImageShader>? samplerUniforms,
}) {
if (floatUniforms == null) {
floatUniforms = Float32List(_uniformFloatCount);
}
floatUniforms ??= Float32List(_uniformFloatCount);
if (floatUniforms.length != _uniformFloatCount) {
throw ArgumentError(
'floatUniforms size: ${floatUniforms.length} must match given shader '
@@ -4291,7 +4282,7 @@ class Vertices extends NativeFieldWrapperClass1 {
}
/// Creates a set of vertex data for use with [Canvas.drawVertices], directly
/// using the encoding methods of [new Vertices].
/// using the encoding methods of [Vertices.new].
/// Note that this constructor uses raw typed data lists,
/// so it runs faster than the [Vertices()] constructor
/// because it doesn't require any conversion from Dart lists.
@@ -5057,8 +5048,8 @@ class Canvas extends NativeFieldWrapperClass1 {
/// first.
///
/// To align the text, set the `textAlign` on the [ParagraphStyle] object
/// passed to the [new ParagraphBuilder] constructor. For more details see
/// [TextAlign] and the discussion at [new ParagraphStyle].
/// passed to the [ParagraphBuilder.new] constructor. For more details see
/// [TextAlign] and the discussion at [ParagraphStyle.new].
///
/// If the text is left aligned or justified, the left margin will be at the
/// position specified by the `offset` argument's [Offset.dx] coordinate.
@@ -5129,7 +5120,7 @@ class Canvas extends NativeFieldWrapperClass1 {
/// All parameters must not be null.
///
/// See also:
/// * [new Vertices], which creates a set of vertices to draw on the canvas.
/// * [Vertices.new], which creates a set of vertices to draw on the canvas.
/// * [Vertices.raw], which creates the vertices using typed data lists
/// rather than unencoded lists.
/// * [paint], Image shaders can be used to draw images on a triangular mesh.

View File

@@ -2384,7 +2384,7 @@ class ParagraphConstraints {
/// follows).
///
/// The width influences how ellipses are applied. See the discussion at
/// [new ParagraphStyle] for more details.
/// [ParagraphStyle.new] for more details.
///
/// This width is also used to position glyphs according to the [TextAlign]
/// alignment described in the [ParagraphStyle] used when building the
@@ -2717,7 +2717,7 @@ class Paragraph extends NativeFieldWrapperClass1 {
/// constraint.
///
/// See the discussion of the `maxLines` and `ellipsis` arguments at
/// [new ParagraphStyle].
/// [ParagraphStyle.new].
@FfiNative<Bool Function(Pointer<Void>)>('Paragraph::didExceedMaxLines', isLeaf: true)
external bool get didExceedMaxLines;
@@ -2886,7 +2886,7 @@ class Paragraph extends NativeFieldWrapperClass1 {
///
/// To set the paragraph's alignment, truncation, and ellipsizing behavior, pass
/// an appropriately-configured [ParagraphStyle] object to the
/// [new ParagraphBuilder] constructor.
/// [ParagraphBuilder.new] constructor.
///
/// Then, call combinations of [pushStyle], [addText], and [pop] to add styled
/// text to the object.
@@ -3164,6 +3164,7 @@ Future<void> loadFontFromList(Uint8List list, {String? fontFamily}) {
return _futurize(
(_Callback<void> callback) {
_loadFontFromList(list, callback, fontFamily ?? '');
return null;
}
).then((_) => _sendFontChangeMessage());
}