[web] Remove unnecessary code from sdk_rewriter (flutter/engine#36124)

This commit is contained in:
Mouad Debbar
2022-09-30 17:00:53 -04:00
committed by GitHub
parent 6015f5d14e
commit 88f0493704
2 changed files with 1 additions and 33 deletions

View File

@@ -211,14 +211,7 @@ String validateApiFile(String apiFilePath, String apiFileCode, String libraryNam
}
String preprocessPartFile(String source, String libraryName) {
if (source.startsWith('part of $libraryName;') || source.contains('\npart of $libraryName;')) {
// The file hasn't been migrated yet.
// Do nothing.
} else {
// Insert the part directive at the beginning of the file.
source = 'part of $libraryName;\n$source';
}
return source;
return 'part of $libraryName;\n$source';
}
/// Responsible for performing string replacements.

View File

@@ -113,31 +113,6 @@ part of dart._engine;
void printSomething() {
print('something');
}
''';
final String result = processSource(
source,
(String source) => preprocessPartFile(source, 'engine'),
generatePartsPatterns('engine'),
);
expect(result, expected);
});
test('does not insert an extra part directive', () {
const String source = '''
part of engine;
void printSomething() {
print('something');
}
''';
const String expected = '''
part of dart._engine;
void printSomething() {
print('something');
}