From 9a6e541bf4e6ab080570edb835223492e253142c Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Mon, 19 Apr 2021 18:29:01 -0500 Subject: [PATCH] Library and Class requires fileUri (flutter/engine#25657) --- .../test/to_string_test.dart | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/engine/src/flutter/flutter_frontend_server/test/to_string_test.dart b/engine/src/flutter/flutter_frontend_server/test/to_string_test.dart index af10a28518..68f9a907de 100644 --- a/engine/src/flutter/flutter_frontend_server/test/to_string_test.dart +++ b/engine/src/flutter/flutter_frontend_server/test/to_string_test.dart @@ -69,7 +69,8 @@ Future main(List args) async { final MockProcedure procedure = MockProcedure(); final MockFunctionNode function = MockFunctionNode(); final MockStatement statement = MockStatement(); - final Library library = Library(Uri.parse('package:some_package/src/blah.dart')); + final Uri uri = Uri.parse('package:some_package/src/blah.dart'); + final Library library = Library(uri, fileUri: uri); when(procedure.function).thenReturn(function); when(procedure.name).thenReturn(Name('toString')); when(procedure.annotations).thenReturn(const []); @@ -88,12 +89,13 @@ Future main(List args) async { final MockProcedure procedure = MockProcedure(); final MockFunctionNode function = MockFunctionNode(); final MockStatement statement = MockStatement(); - final Library library = Library(Uri.parse('package:some_package/src/blah.dart')); + final Uri uri = Uri.parse('package:some_package/src/blah.dart'); + final Library library = Library(uri, fileUri: uri); when(procedure.function).thenReturn(function); when(procedure.name).thenReturn(Name('toString')); when(procedure.annotations).thenReturn(const []); when(procedure.enclosingLibrary).thenReturn(library); - when(procedure.enclosingClass).thenReturn(Class(name: 'foo')); + when(procedure.enclosingClass).thenReturn(Class(name: 'foo', fileUri: uri)); when(procedure.isAbstract).thenReturn(true); when(procedure.isStatic).thenReturn(false); when(function.body).thenReturn(statement); @@ -107,12 +109,13 @@ Future main(List args) async { final MockProcedure procedure = MockProcedure(); final MockFunctionNode function = MockFunctionNode(); final MockStatement statement = MockStatement(); - final Library library = Library(Uri.parse('package:some_package/src/blah.dart')); + final Uri uri = Uri.parse('package:some_package/src/blah.dart'); + final Library library = Library(uri, fileUri: uri); when(procedure.function).thenReturn(function); when(procedure.name).thenReturn(Name('toString')); when(procedure.annotations).thenReturn(const []); when(procedure.enclosingLibrary).thenReturn(library); - when(procedure.enclosingClass).thenReturn(Class(name: 'foo')); + when(procedure.enclosingClass).thenReturn(Class(name: 'foo', fileUri: uri)); when(procedure.isAbstract).thenReturn(false); when(procedure.isStatic).thenReturn(true); when(function.body).thenReturn(statement); @@ -126,12 +129,13 @@ Future main(List args) async { final MockProcedure procedure = MockProcedure(); final MockFunctionNode function = MockFunctionNode(); final MockStatement statement = MockStatement(); - final Library library = Library(Uri.parse('package:some_package/src/blah.dart')); + final Uri uri = Uri.parse('package:some_package/src/blah.dart'); + final Library library = Library(uri, fileUri: uri); when(procedure.function).thenReturn(function); when(procedure.name).thenReturn(Name('toString')); when(procedure.annotations).thenReturn(const []); when(procedure.enclosingLibrary).thenReturn(library); - when(procedure.enclosingClass).thenReturn(Class(name: 'foo')..isEnum = true); + when(procedure.enclosingClass).thenReturn(Class(name: 'foo', fileUri: uri)..isEnum = true); when(procedure.isAbstract).thenReturn(false); when(procedure.isStatic).thenReturn(false); when(function.body).thenReturn(statement); @@ -145,12 +149,13 @@ Future main(List args) async { final MockProcedure procedure = MockProcedure(); final MockFunctionNode function = MockFunctionNode(); final MockStatement statement = MockStatement(); - final Library library = Library(Uri.parse('package:some_package/src/blah.dart')); + final Uri uri = Uri.parse('package:some_package/src/blah.dart'); + final Library library = Library(uri, fileUri: uri); when(procedure.function).thenReturn(function); when(procedure.name).thenReturn(Name('toString')); when(procedure.annotations).thenReturn(const []); when(procedure.enclosingLibrary).thenReturn(library); - when(procedure.enclosingClass).thenReturn(Class(name: 'foo')); + when(procedure.enclosingClass).thenReturn(Class(name: 'foo', fileUri: uri)); when(procedure.isAbstract).thenReturn(false); when(procedure.isStatic).thenReturn(false); when(function.body).thenReturn(statement); @@ -164,9 +169,10 @@ Future main(List args) async { final MockProcedure procedure = MockProcedure(); final MockFunctionNode function = MockFunctionNode(); final MockStatement statement = MockStatement(); - final Library library = Library(Uri.parse('dart:ui')); + final Uri uri = Uri.parse('dart:ui'); + final Library library = Library(uri, fileUri: uri); final Name name = Name('toString'); - final Class annotation = Class(name: '_KeepToString')..parent = Library(Uri.parse('dart:ui')); + final Class annotation = Class(name: '_KeepToString', fileUri: uri)..parent = library; when(procedure.function).thenReturn(function); when(procedure.name).thenReturn(name); @@ -181,7 +187,7 @@ Future main(List args) async { ]); when(procedure.enclosingLibrary).thenReturn(library); - when(procedure.enclosingClass).thenReturn(Class(name: 'foo')); + when(procedure.enclosingClass).thenReturn(Class(name: 'foo', fileUri: uri)); when(procedure.isAbstract).thenReturn(false); when(procedure.isStatic).thenReturn(false); when(function.body).thenReturn(statement); @@ -202,14 +208,15 @@ Future main(List args) async { final MockProcedure procedure = MockProcedure(); final MockFunctionNode function = MockFunctionNode(); final MockStatement statement = MockStatement(); - final Library library = Library(Uri.parse('dart:ui')); + final Uri uri = Uri.parse('dart:ui'); + final Library library = Library(uri, fileUri: uri); final Name name = Name('toString'); when(procedure.function).thenReturn(function); when(procedure.name).thenReturn(name); when(procedure.annotations).thenReturn(const []); when(procedure.enclosingLibrary).thenReturn(library); - when(procedure.enclosingClass).thenReturn(Class(name: 'foo')); + when(procedure.enclosingClass).thenReturn(Class(name: 'foo', fileUri: uri)); when(procedure.isAbstract).thenReturn(false); when(procedure.isStatic).thenReturn(false); when(function.body).thenReturn(statement); @@ -223,14 +230,15 @@ Future main(List args) async { final MockProcedure procedure = MockProcedure(); final MockFunctionNode function = MockFunctionNode(); final MockStatement statement = MockStatement(); - final Library library = Library(Uri.parse('package:flutter/src/foundation.dart')); + final Uri uri = Uri.parse('package:flutter/src/foundation.dart'); + final Library library = Library(uri, fileUri: uri); final Name name = Name('toString'); when(procedure.function).thenReturn(function); when(procedure.name).thenReturn(name); when(procedure.annotations).thenReturn(const []); when(procedure.enclosingLibrary).thenReturn(library); - when(procedure.enclosingClass).thenReturn(Class(name: 'foo')); + when(procedure.enclosingClass).thenReturn(Class(name: 'foo', fileUri: uri)); when(procedure.isAbstract).thenReturn(false); when(procedure.isStatic).thenReturn(false); when(function.body).thenReturn(statement);