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

Side by Side Diff: pkg/analyzer/test/generated/test_support.dart

Issue 1526973005: Replace using '_commentBeforeFunction' with visitXyzInScope(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.test.generated.test_support; 5 library analyzer.test.generated.test_support;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
11 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; 11 import 'package:analyzer/src/generated/ast.dart'
12 show AstNode, NodeLocator, SimpleIdentifier;
12 import 'package:analyzer/src/generated/engine.dart'; 13 import 'package:analyzer/src/generated/engine.dart';
13 import 'package:analyzer/src/generated/error.dart'; 14 import 'package:analyzer/src/generated/error.dart';
14 import 'package:analyzer/src/generated/java_core.dart'; 15 import 'package:analyzer/src/generated/java_core.dart';
15 import 'package:analyzer/src/generated/java_engine.dart'; 16 import 'package:analyzer/src/generated/java_engine.dart';
16 import 'package:analyzer/src/generated/source.dart'; 17 import 'package:analyzer/src/generated/source.dart';
17 import 'package:plugin/manager.dart'; 18 import 'package:plugin/manager.dart';
18 import 'package:plugin/plugin.dart'; 19 import 'package:plugin/plugin.dart';
19 import 'package:unittest/unittest.dart'; 20 import 'package:unittest/unittest.dart';
20 21
21 import 'resolver_test.dart'; 22 import 'resolver_test.dart';
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 */ 127 */
127 static AstNode findNode( 128 static AstNode findNode(
128 AstNode root, String code, String prefix, Predicate<AstNode> predicate) { 129 AstNode root, String code, String prefix, Predicate<AstNode> predicate) {
129 int offset = code.indexOf(prefix); 130 int offset = code.indexOf(prefix);
130 if (offset == -1) { 131 if (offset == -1) {
131 throw new IllegalArgumentException("Not found '$prefix'."); 132 throw new IllegalArgumentException("Not found '$prefix'.");
132 } 133 }
133 AstNode node = new NodeLocator(offset).searchWithin(root); 134 AstNode node = new NodeLocator(offset).searchWithin(root);
134 return node.getAncestor(predicate); 135 return node.getAncestor(predicate);
135 } 136 }
137
138 /**
139 * Find the [SimpleIdentifier] with at offset of the "prefix".
140 */
141 static SimpleIdentifier findSimpleIdentifier(
142 AstNode root, String code, String prefix) {
143 int offset = code.indexOf(prefix);
144 if (offset == -1) {
145 throw new IllegalArgumentException("Not found '$prefix'.");
146 }
147 return new NodeLocator(offset).searchWithin(root);
148 }
136 } 149 }
137 150
138 /** 151 /**
139 * Instances of the class `GatheringErrorListener` implement an error listener t hat collects 152 * Instances of the class `GatheringErrorListener` implement an error listener t hat collects
140 * all of the errors passed to it for later examination. 153 * all of the errors passed to it for later examination.
141 */ 154 */
142 class GatheringErrorListener implements AnalysisErrorListener { 155 class GatheringErrorListener implements AnalysisErrorListener {
143 /** 156 /**
144 * An empty array of errors used when no errors are expected. 157 * An empty array of errors used when no errors are expected.
145 */ 158 */
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 if (other is TestSource) { 666 if (other is TestSource) {
654 return other.uri == uri; 667 return other.uri == uri;
655 } 668 }
656 return false; 669 return false;
657 } 670 }
658 671
659 Uri resolveRelativeUri(Uri uri) { 672 Uri resolveRelativeUri(Uri uri) {
660 return this.uri.resolveUri(uri); 673 return this.uri.resolveUri(uri);
661 } 674 }
662 } 675 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698