Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: pkg/dev_compiler/tool/patch_sdk.dart

Issue 2874713005: Disambiguate setters and getters when patching DDC SDK. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 /// Command line tool to merge the SDK libraries and our patch files. 6 /// Command line tool to merge the SDK libraries and our patch files.
7 /// This is currently designed as an offline tool, but we could automate it. 7 /// This is currently designed as an offline tool, but we could automate it.
8 8
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } else { 342 } else {
343 mergeDeclarations.add(node); 343 mergeDeclarations.add(node);
344 } 344 }
345 } 345 }
346 346
347 @override 347 @override
348 visitFunctionBody(node) {} // skip method bodies 348 visitFunctionBody(node) {} // skip method bodies
349 } 349 }
350 350
351 String _qualifiedName(Declaration node) { 351 String _qualifiedName(Declaration node) {
352 var result = "";
353
352 var parent = node.parent; 354 var parent = node.parent;
353 var className = '';
354 if (parent is ClassDeclaration) { 355 if (parent is ClassDeclaration) {
355 className = parent.name.name + '.'; 356 result = "${parent.name.name}.";
356 } 357 }
358
357 var name = (node as dynamic).name; 359 var name = (node as dynamic).name;
358 return className + (name != null ? name.name : ''); 360 if (name != null) result += name.name;
361
362 // Make sure setters and getters don't collide.
363 if ((node is FunctionDeclaration || node is MethodDeclaration) &&
364 (node as dynamic).isSetter) {
365 result += "=";
366 }
367
368 return result;
359 } 369 }
360 370
361 bool _isPatch(AnnotatedNode node) => node.metadata.any(_isPatchAnnotation); 371 bool _isPatch(AnnotatedNode node) => node.metadata.any(_isPatchAnnotation);
362 372
363 bool _isPatchAnnotation(Annotation m) => 373 bool _isPatchAnnotation(Annotation m) =>
364 m.name.name == 'patch' && m.constructorName == null && m.arguments == null; 374 m.name.name == 'patch' && m.constructorName == null && m.arguments == null;
365 375
366 /// Editable string buffer. 376 /// Editable string buffer.
367 /// 377 ///
368 /// Applies a series of edits (insertions, removals, replacements) using 378 /// Applies a series of edits (insertions, removals, replacements) using
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (diff != 0) return diff; 464 if (diff != 0) return diff;
455 return end - other.end; 465 return end - other.end;
456 } 466 }
457 } 467 }
458 468
459 List<SdkLibrary> _getSdkLibraries(String contents) { 469 List<SdkLibrary> _getSdkLibraries(String contents) {
460 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); 470 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true);
461 parseCompilationUnit(contents).accept(libraryBuilder); 471 parseCompilationUnit(contents).accept(libraryBuilder);
462 return libraryBuilder.librariesMap.sdkLibraries; 472 return libraryBuilder.librariesMap.sdkLibraries;
463 } 473 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698