[web] Remove unnecessary code from sdk_rewriter (flutter/engine#36124)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user