| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /** | 5 /** |
| 6 * This file contains code to output a description of tasks and their | 6 * This file contains code to output a description of tasks and their |
| 7 * dependencies in ".dot" format. Prior to running, the user should run "pub | 7 * dependencies in ".dot" format. Prior to running, the user should run "pub |
| 8 * get" in the analyzer directory to ensure that a "packages" folder exists. | 8 * get" in the analyzer directory to ensure that a "packages" folder exists. |
| 9 * | 9 * |
| 10 * TODO(paulberry): | 10 * TODO(paulberry): |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 import 'package:analyzer/file_system/physical_file_system.dart'; | 25 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 26 import 'package:analyzer/src/generated/constant.dart'; | 26 import 'package:analyzer/src/generated/constant.dart'; |
| 27 import 'package:analyzer/src/generated/element.dart'; | 27 import 'package:analyzer/src/generated/element.dart'; |
| 28 import 'package:analyzer/src/generated/engine.dart'; | 28 import 'package:analyzer/src/generated/engine.dart'; |
| 29 import 'package:analyzer/src/generated/java_io.dart'; | 29 import 'package:analyzer/src/generated/java_io.dart'; |
| 30 import 'package:analyzer/src/generated/sdk.dart'; | 30 import 'package:analyzer/src/generated/sdk.dart'; |
| 31 import 'package:analyzer/src/generated/sdk_io.dart'; | 31 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 32 import 'package:analyzer/src/generated/source.dart'; | 32 import 'package:analyzer/src/generated/source.dart'; |
| 33 import 'package:analyzer/src/generated/source_io.dart'; | 33 import 'package:analyzer/src/generated/source_io.dart'; |
| 34 import 'package:path/path.dart' as path; | 34 import 'package:path/path.dart' as path; |
| 35 import 'dart:convert'; | |
| 36 | 35 |
| 37 /** | 36 /** |
| 38 * Generate the target .dot file. | 37 * Generate the target .dot file. |
| 39 */ | 38 */ |
| 40 main() { | 39 main() { |
| 41 new Driver().generateFile(); | 40 new Driver().generateFile(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 typedef void GetterFinderCallback(PropertyAccessorElement element); | 43 typedef void GetterFinderCallback(PropertyAccessorElement element); |
| 45 | 44 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 66 | 65 |
| 67 /** | 66 /** |
| 68 * Determine if the output [file] contains the expected contents. | 67 * Determine if the output [file] contains the expected contents. |
| 69 */ | 68 */ |
| 70 bool checkFile() { | 69 bool checkFile() { |
| 71 String expectedContents = generateFileContents(); | 70 String expectedContents = generateFileContents(); |
| 72 String actualContents = file.readAsStringSync(); | 71 String actualContents = file.readAsStringSync(); |
| 73 // Normalize Windows line endings to Unix line endings so that the | 72 // Normalize Windows line endings to Unix line endings so that the |
| 74 // comparison doesn't fail on Windows. | 73 // comparison doesn't fail on Windows. |
| 75 actualContents = actualContents.replaceAll('\r\n', '\n'); | 74 actualContents = actualContents.replaceAll('\r\n', '\n'); |
| 76 if (expectedContents != actualContents) { | |
| 77 // Print additional information for debugging. | |
| 78 // TODO(paulberry): eliminate this when it is no longer needed. | |
| 79 print('expected: ${JSON.encode(expectedContents)}'); | |
| 80 print('actual: ${JSON.encode(actualContents)}'); | |
| 81 } | |
| 82 return expectedContents == actualContents; | 75 return expectedContents == actualContents; |
| 83 } | 76 } |
| 84 | 77 |
| 85 /** | 78 /** |
| 86 * Starting at [node], find all calls to registerExtension() which refer to | 79 * Starting at [node], find all calls to registerExtension() which refer to |
| 87 * the given [extensionIdVariable], and execute [callback] for the associated | 80 * the given [extensionIdVariable], and execute [callback] for the associated |
| 88 * result descriptors. | 81 * result descriptors. |
| 89 */ | 82 */ |
| 90 void findExtensions(AstNode node, TopLevelVariableElement extensionIdVariable, | 83 void findExtensions(AstNode node, TopLevelVariableElement extensionIdVariable, |
| 91 void callback(descriptorName)) { | 84 void callback(descriptorName)) { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 @override | 338 @override |
| 346 visitIdentifier(Identifier node) { | 339 visitIdentifier(Identifier node) { |
| 347 Element element = node.staticElement; | 340 Element element = node.staticElement; |
| 348 if (element is PropertyAccessorElement && | 341 if (element is PropertyAccessorElement && |
| 349 element.isGetter && | 342 element.isGetter && |
| 350 element.returnType.isSubtypeOf(type)) { | 343 element.returnType.isSubtypeOf(type)) { |
| 351 callback(element); | 344 callback(element); |
| 352 } | 345 } |
| 353 } | 346 } |
| 354 } | 347 } |
| OLD | NEW |