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

Side by Side Diff: pkg/analyzer/lib/src/dart/sdk/patch.dart

Issue 2746333008: Run dartfmt on dart2js codebase. (Closed)
Patch Set: Format all analyzer packages Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.dart.sdk.patch; 5 library analyzer.src.dart.sdk.patch;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/error/listener.dart'; 9 import 'package:analyzer/error/listener.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 throw new ArgumentError( 44 throw new ArgumentError(
45 'The URI of the unit to patch must have the "dart" scheme: $uri'); 45 'The URI of the unit to patch must have the "dart" scheme: $uri');
46 } 46 }
47 List<String> uriSegments = uri.pathSegments; 47 List<String> uriSegments = uri.pathSegments;
48 String libraryName = uriSegments.first; 48 String libraryName = uriSegments.first;
49 libraryUriStr = 'dart:$libraryName'; 49 libraryUriStr = 'dart:$libraryName';
50 isLibraryDefiningUnit = uriSegments.length == 1; 50 isLibraryDefiningUnit = uriSegments.length == 1;
51 _allowNewPublicNames = libraryName == '_internal'; 51 _allowNewPublicNames = libraryName == '_internal';
52 } 52 }
53 // Prepare the patch files to apply. 53 // Prepare the patch files to apply.
54 List<String> patchPaths = allPatchPaths[libraryUriStr] ?? const <String> []; 54 List<String> patchPaths = allPatchPaths[libraryUriStr] ?? const <String>[];
55 55
56 for (String path in patchPaths) { 56 for (String path in patchPaths) {
57 File patchFile = resourceProvider.getFile(path); 57 File patchFile = resourceProvider.getFile(path);
58 if (!patchFile.exists) { 58 if (!patchFile.exists) {
59 throw new ArgumentError( 59 throw new ArgumentError(
60 'The patch file ${patchFile.path} for $source does not exist.'); 60 'The patch file ${patchFile.path} for $source does not exist.');
61 } 61 }
62 Source patchSource = patchFile.createSource(); 62 Source patchSource = patchFile.createSource();
63 CompilationUnit patchUnit = parse(patchSource, strongMode, errorListener); 63 CompilationUnit patchUnit = parse(patchSource, strongMode, errorListener);
64 64
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 459 }
460 460
461 /** 461 /**
462 * Replace tokens of the [oldNode] with tokens of the [newNode]. 462 * Replace tokens of the [oldNode] with tokens of the [newNode].
463 */ 463 */
464 static void _replaceNodeTokens(AstNode oldNode, AstNode newNode) { 464 static void _replaceNodeTokens(AstNode oldNode, AstNode newNode) {
465 oldNode.beginToken.previous.setNext(newNode.beginToken); 465 oldNode.beginToken.previous.setNext(newNode.beginToken);
466 newNode.endToken.setNext(oldNode.endToken.next); 466 newNode.endToken.setNext(oldNode.endToken.next);
467 } 467 }
468 } 468 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart ('k') | pkg/analyzer/lib/src/generated/element_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698