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

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

Issue 2326813002: Replace and remove JavaException(s). (Closed)
Patch Set: Created 4 years, 3 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) 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/ast/ast.dart' show AstNode, SimpleIdentifier; 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode, SimpleIdentifier;
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
11 import 'package:analyzer/dart/element/type.dart'; 11 import 'package:analyzer/dart/element/type.dart';
12 import 'package:analyzer/src/dart/ast/utilities.dart'; 12 import 'package:analyzer/src/dart/ast/utilities.dart';
13 import 'package:analyzer/src/generated/engine.dart'; 13 import 'package:analyzer/src/generated/engine.dart';
14 import 'package:analyzer/src/generated/error.dart'; 14 import 'package:analyzer/src/generated/error.dart';
15 import 'package:analyzer/src/generated/java_core.dart';
16 import 'package:analyzer/src/generated/java_engine.dart'; 15 import 'package:analyzer/src/generated/java_engine.dart';
17 import 'package:analyzer/src/generated/source.dart'; 16 import 'package:analyzer/src/generated/source.dart';
18 import 'package:plugin/manager.dart'; 17 import 'package:plugin/manager.dart';
19 import 'package:plugin/plugin.dart'; 18 import 'package:plugin/plugin.dart';
20 import 'package:unittest/unittest.dart'; 19 import 'package:unittest/unittest.dart';
21 20
22 import 'analysis_context_factory.dart'; 21 import 'analysis_context_factory.dart';
23 22
24 /** 23 /**
25 * The class `EngineTestCase` defines utility methods for making assertions. 24 * The class `EngineTestCase` defines utility methods for making assertions.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return object; 121 return object;
123 } 122 }
124 123
125 /** 124 /**
126 * @return the [AstNode] with requested type at offset of the "prefix". 125 * @return the [AstNode] with requested type at offset of the "prefix".
127 */ 126 */
128 static AstNode findNode( 127 static AstNode findNode(
129 AstNode root, String code, String prefix, Predicate<AstNode> predicate) { 128 AstNode root, String code, String prefix, Predicate<AstNode> predicate) {
130 int offset = code.indexOf(prefix); 129 int offset = code.indexOf(prefix);
131 if (offset == -1) { 130 if (offset == -1) {
132 throw new IllegalArgumentException("Not found '$prefix'."); 131 throw new ArgumentError("Not found '$prefix'.");
133 } 132 }
134 AstNode node = new NodeLocator(offset).searchWithin(root); 133 AstNode node = new NodeLocator(offset).searchWithin(root);
135 return node.getAncestor(predicate); 134 return node.getAncestor(predicate);
136 } 135 }
137 136
138 /** 137 /**
139 * Find the [SimpleIdentifier] with at offset of the "prefix". 138 * Find the [SimpleIdentifier] with at offset of the "prefix".
140 */ 139 */
141 static SimpleIdentifier findSimpleIdentifier( 140 static SimpleIdentifier findSimpleIdentifier(
142 AstNode root, String code, String prefix) { 141 AstNode root, String code, String prefix) {
143 int offset = code.indexOf(prefix); 142 int offset = code.indexOf(prefix);
144 if (offset == -1) { 143 if (offset == -1) {
145 throw new IllegalArgumentException("Not found '$prefix'."); 144 throw new ArgumentError("Not found '$prefix'.");
146 } 145 }
147 return new NodeLocator(offset).searchWithin(root); 146 return new NodeLocator(offset).searchWithin(root);
148 } 147 }
149 } 148 }
150 149
151 /** 150 /**
152 * Instances of the class `GatheringErrorListener` implement an error listener t hat collects 151 * Instances of the class `GatheringErrorListener` implement an error listener t hat collects
153 * all of the errors passed to it for later examination. 152 * all of the errors passed to it for later examination.
154 */ 153 */
155 class GatheringErrorListener implements AnalysisErrorListener { 154 class GatheringErrorListener implements AnalysisErrorListener {
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 int get modificationStamp => 581 int get modificationStamp =>
583 generateExceptionOnRead ? -1 : _modificationStamp; 582 generateExceptionOnRead ? -1 : _modificationStamp;
584 583
585 String get shortName { 584 String get shortName {
586 return _name; 585 return _name;
587 } 586 }
588 587
589 Uri get uri => new Uri.file(_name); 588 Uri get uri => new Uri.file(_name);
590 589
591 UriKind get uriKind { 590 UriKind get uriKind {
592 throw new UnsupportedOperationException(); 591 throw new UnsupportedError('uriKind');
593 } 592 }
594 593
595 bool operator ==(Object other) { 594 bool operator ==(Object other) {
596 if (other is TestSource) { 595 if (other is TestSource) {
597 return other._name == _name; 596 return other._name == _name;
598 } 597 }
599 return false; 598 return false;
600 } 599 }
601 600
602 bool exists() => exists2; 601 bool exists() => exists2;
603 void getContentsToReceiver(Source_ContentReceiver receiver) { 602 void getContentsToReceiver(Source_ContentReceiver receiver) {
604 throw new UnsupportedOperationException(); 603 throw new UnsupportedError('getContentsToReceiver');
605 } 604 }
606 605
607 Source resolve(String uri) { 606 Source resolve(String uri) {
608 throw new UnsupportedOperationException(); 607 throw new UnsupportedError('resolve');
609 } 608 }
610 609
611 void setContents(String value) { 610 void setContents(String value) {
612 generateExceptionOnRead = false; 611 generateExceptionOnRead = false;
613 _modificationStamp = new DateTime.now().millisecondsSinceEpoch; 612 _modificationStamp = new DateTime.now().millisecondsSinceEpoch;
614 _contents = value; 613 _contents = value;
615 } 614 }
616 615
617 @override 616 @override
618 String toString() => '$_name'; 617 String toString() => '$_name';
(...skipping 18 matching lines...) Expand all
637 return UriKind.FILE_URI; 636 return UriKind.FILE_URI;
638 } 637 }
639 638
640 bool operator ==(Object other) { 639 bool operator ==(Object other) {
641 if (other is TestSource) { 640 if (other is TestSource) {
642 return other.uri == uri; 641 return other.uri == uri;
643 } 642 }
644 return false; 643 return false;
645 } 644 }
646 } 645 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698