5bac4d9b0c
This reverts commitb9bf239c65. Reason for revert: The angular and angular plugins have been updated so as to make this safe. Original change's description: > Revert "Add support for recording context information with analysis errors, with one example" > > This reverts commit6114435ea5. > > Reason for revert: Broke angular and angular_analyzer_plugin > > Original change's description: > > Add support for recording context information with analysis errors, with one example > > > > Change-Id: Iba1c48163ce264d85a68bcb9f70e5025a7cdbfbb > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100563 > > Reviewed-by: Konstantin Shcheglov <scheglov@google.com> > > Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> > > TBR=scheglov@google.com,brianwilkerson@google.com > > Change-Id: I275c6e4473de73199ea9b5e490379ba58aec1d43 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100628 > Reviewed-by: Paul Berry <paulberry@google.com> > Commit-Queue: Paul Berry <paulberry@google.com> TBR=paulberry@google.com,scheglov@google.com,brianwilkerson@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Ib1b7e63a459e63bcbf02f26bcf167ddad45295b7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101004 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Paul Berry <paulberry@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
191 lines
4.0 KiB
Dart
191 lines
4.0 KiB
Dart
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:analyzer/diagnostic/diagnostic.dart';
|
|
import 'package:analyzer/error/error.dart';
|
|
import 'package:analyzer/source/line_info.dart';
|
|
import 'package:analyzer/src/generated/engine.dart';
|
|
import 'package:analyzer/src/generated/source.dart';
|
|
import 'package:analyzer_cli/src/options.dart';
|
|
|
|
class MockAnalysisError implements AnalysisError {
|
|
@override
|
|
MockSource source;
|
|
|
|
@override
|
|
MockErrorCode errorCode;
|
|
|
|
@override
|
|
int offset;
|
|
|
|
@override
|
|
String message;
|
|
|
|
@override
|
|
bool isStaticOnly;
|
|
|
|
@override
|
|
int length;
|
|
|
|
MockAnalysisError(this.source, this.errorCode, this.offset, this.message);
|
|
|
|
@override
|
|
List<DiagnosticMessage> get contextMessages => null;
|
|
|
|
@override
|
|
String get correction => null;
|
|
|
|
@override
|
|
String get correctionMessage => null;
|
|
|
|
@override
|
|
DiagnosticMessage get problemMessage => null;
|
|
|
|
@override
|
|
Severity get severity => null;
|
|
}
|
|
|
|
class MockAnalysisErrorInfo implements AnalysisErrorInfo {
|
|
@override
|
|
LineInfo lineInfo;
|
|
|
|
@override
|
|
List<AnalysisError> errors;
|
|
|
|
MockAnalysisErrorInfo(this.lineInfo, this.errors);
|
|
}
|
|
|
|
class MockCommandLineOptions implements CommandLineOptions {
|
|
bool enableTypeChecks = false;
|
|
bool infosAreFatal = false;
|
|
bool machineFormat = false;
|
|
bool verbose = false;
|
|
bool color = false;
|
|
|
|
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
|
|
}
|
|
|
|
class MockErrorCode implements ErrorCode {
|
|
@override
|
|
ErrorType type;
|
|
|
|
@override
|
|
ErrorSeverity errorSeverity;
|
|
|
|
@override
|
|
String name;
|
|
|
|
@override
|
|
String url;
|
|
|
|
MockErrorCode(this.type, this.errorSeverity, this.name);
|
|
|
|
@override
|
|
String get correction {
|
|
throw new StateError('Unexpected invocation of correction');
|
|
}
|
|
|
|
@override
|
|
bool get isUnresolvedIdentifier => false;
|
|
|
|
@override
|
|
String get message {
|
|
throw new StateError('Unexpected invocation of message');
|
|
}
|
|
|
|
@override
|
|
String get uniqueName {
|
|
throw new StateError('Unexpected invocation of uniqueName');
|
|
}
|
|
}
|
|
|
|
class MockLineInfo implements LineInfo {
|
|
CharacterLocation defaultLocation;
|
|
|
|
MockLineInfo({this.defaultLocation});
|
|
|
|
@override
|
|
int get lineCount {
|
|
throw new StateError('Unexpected invocation of lineCount');
|
|
}
|
|
|
|
@override
|
|
List<int> get lineStarts {
|
|
throw new StateError('Unexpected invocation of lineStarts');
|
|
}
|
|
|
|
@override
|
|
CharacterLocation getLocation(int offset) {
|
|
if (defaultLocation != null) {
|
|
return defaultLocation;
|
|
}
|
|
throw new StateError('Unexpected invocation of getLocation');
|
|
}
|
|
|
|
@override
|
|
int getOffsetOfLine(int lineNumber) {
|
|
throw new StateError('Unexpected invocation of getOffsetOfLine');
|
|
}
|
|
|
|
@override
|
|
int getOffsetOfLineAfter(int offset) {
|
|
throw new StateError('Unexpected invocation of getOffsetOfLineAfter');
|
|
}
|
|
}
|
|
|
|
class MockSource implements Source {
|
|
@override
|
|
String fullName;
|
|
|
|
MockSource(this.fullName);
|
|
|
|
@override
|
|
TimestampedData<String> get contents {
|
|
throw new StateError('Unexpected invocation of contents');
|
|
}
|
|
|
|
@override
|
|
String get encoding {
|
|
throw new StateError('Unexpected invocation of encoding');
|
|
}
|
|
|
|
@override
|
|
bool get isInSystemLibrary {
|
|
throw new StateError('Unexpected invocation of isInSystemLibrary');
|
|
}
|
|
|
|
@override
|
|
Source get librarySource {
|
|
throw new StateError('Unexpected invocation of librarySource');
|
|
}
|
|
|
|
@override
|
|
int get modificationStamp {
|
|
throw new StateError('Unexpected invocation of modificationStamp');
|
|
}
|
|
|
|
@override
|
|
String get shortName {
|
|
throw new StateError('Unexpected invocation of shortName');
|
|
}
|
|
|
|
@override
|
|
Source get source {
|
|
throw new StateError('Unexpected invocation of source');
|
|
}
|
|
|
|
@override
|
|
Uri get uri {
|
|
throw new StateError('Unexpected invocation of uri');
|
|
}
|
|
|
|
@override
|
|
UriKind get uriKind => null; //UriKind.FILE_URI;
|
|
|
|
@override
|
|
bool exists() {
|
|
throw new StateError('Unexpected invocation of exists');
|
|
}
|
|
}
|