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

Unified Diff: packages/analyzer/lib/src/generated/java_engine.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: packages/analyzer/lib/src/generated/java_engine.dart
diff --git a/packages/analyzer/lib/src/generated/java_engine.dart b/packages/analyzer/lib/src/generated/java_engine.dart
index d0fb62bd8d8a87d260823f4098af53c312a787c7..784fcb171a2456486dac7b0922b45a09ea166675 100644
--- a/packages/analyzer/lib/src/generated/java_engine.dart
+++ b/packages/analyzer/lib/src/generated/java_engine.dart
@@ -1,106 +1,18 @@
-library java.engine;
+// Copyright (c) 2014, 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 'interner.dart';
-import 'java_core.dart';
+library analyzer.src.generated.java_engine;
-/**
- * A predicate is a one-argument function that returns a boolean value.
- */
-typedef bool Predicate<E>(E argument);
-
-/**
- * Instances of the class `AnalysisException` represent an exception that
- * occurred during the analysis of one or more sources.
- */
-class AnalysisException implements Exception {
- /**
- * The message that explains why the exception occurred.
- */
- final String message;
+import 'package:analyzer/src/generated/interner.dart';
+import 'package:analyzer/src/generated/java_core.dart';
- /**
- * The exception that caused this exception, or `null` if this exception was
- * not caused by another exception.
- */
- final CaughtException cause;
-
- /**
- * Initialize a newly created exception to have the given [message] and
- * [cause].
- */
- AnalysisException([this.message = 'Exception', this.cause = null]);
-
- String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.write("AnalysisException: ");
- buffer.writeln(message);
- if (cause != null) {
- buffer.write('Caused by ');
- cause._writeOn(buffer);
- }
- return buffer.toString();
- }
-}
+export 'package:analyzer/exception/exception.dart';
/**
- * Instances of the class `CaughtException` represent an exception that was
- * caught and has an associated stack trace.
+ * A predicate is a one-argument function that returns a boolean value.
*/
-class CaughtException implements Exception {
- /**
- * The exception that was caught.
- */
- final Object exception;
-
- /**
- * The stack trace associated with the exception.
- */
- StackTrace stackTrace;
-
- /**
- * Initialize a newly created caught exception to have the given [exception]
- * and [stackTrace].
- */
- CaughtException(this.exception, stackTrace) {
- if (stackTrace == null) {
- try {
- throw this;
- } catch (_, st) {
- stackTrace = st;
- }
- }
- this.stackTrace = stackTrace;
- }
-
- @override
- String toString() {
- StringBuffer buffer = new StringBuffer();
- _writeOn(buffer);
- return buffer.toString();
- }
-
- /**
- * Write a textual representation of the caught exception and its associated
- * stack trace.
- */
- void _writeOn(StringBuffer buffer) {
- if (exception is AnalysisException) {
- AnalysisException analysisException = exception;
- buffer.writeln(analysisException.message);
- if (stackTrace != null) {
- buffer.writeln(stackTrace.toString());
- }
- CaughtException cause = analysisException.cause;
- if (cause != null) {
- buffer.write('Caused by ');
- cause._writeOn(buffer);
- }
- } else {
- buffer.writeln(exception.toString());
- buffer.writeln(stackTrace.toString());
- }
- }
-}
+typedef bool Predicate<E>(E argument);
class FileNameUtilities {
static String getExtension(String fileName) {
@@ -121,6 +33,33 @@ class StringUtilities {
static Interner INTERNER = new NullInterner();
+ /**
+ * Compute line starts for the given [content].
+ * Lines end with `\r`, `\n` or `\r\n`.
+ */
+ static List<int> computeLineStarts(String content) {
+ List<int> lineStarts = <int>[0];
+ int length = content.length;
+ int unit;
+ for (int index = 0; index < length; index++) {
+ unit = content.codeUnitAt(index);
+ // Special-case \r\n.
+ if (unit == 0x0D /* \r */) {
+ // Peek ahead to detect a following \n.
+ if ((index + 1 < length) && content.codeUnitAt(index + 1) == 0x0A) {
+ // Line start will get registered at next index at the \n.
+ } else {
+ lineStarts.add(index + 1);
+ }
+ }
+ // \n
+ if (unit == 0x0A) {
+ lineStarts.add(index + 1);
+ }
+ }
+ return lineStarts;
+ }
+
static endsWith3(String str, int c1, int c2, int c3) {
var length = str.length;
return length >= 3 &&
@@ -242,12 +181,11 @@ class StringUtilities {
*/
static String printListOfQuotedNames(List<String> names) {
if (names == null) {
- throw new IllegalArgumentException("The list must not be null");
+ throw new ArgumentError("The list must not be null");
}
int count = names.length;
if (count < 2) {
- throw new IllegalArgumentException(
- "The list must contain at least two names");
+ throw new ArgumentError("The list must contain at least two names");
}
StringBuffer buffer = new StringBuffer();
buffer.write("'");
« no previous file with comments | « packages/analyzer/lib/src/generated/java_core.dart ('k') | packages/analyzer/lib/src/generated/java_engine_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698