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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/error/ErrorReporter.java

Issue 66253002: Version 0.8.10.9 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
11 * or implied. See the License for the specific language governing permissions a nd limitations under 11 * or implied. See the License for the specific language governing permissions a nd limitations under
12 * the License. 12 * the License.
13 */ 13 */
14 package com.google.dart.engine.internal.error; 14 package com.google.dart.engine.internal.error;
15 15
16 import com.google.dart.engine.ast.ASTNode; 16 import com.google.dart.engine.ast.ASTNode;
17 import com.google.dart.engine.element.Element;
17 import com.google.dart.engine.error.AnalysisError; 18 import com.google.dart.engine.error.AnalysisError;
18 import com.google.dart.engine.error.AnalysisErrorListener; 19 import com.google.dart.engine.error.AnalysisErrorListener;
19 import com.google.dart.engine.error.AnalysisErrorWithProperties; 20 import com.google.dart.engine.error.AnalysisErrorWithProperties;
20 import com.google.dart.engine.error.ErrorCode; 21 import com.google.dart.engine.error.ErrorCode;
21 import com.google.dart.engine.scanner.Token; 22 import com.google.dart.engine.scanner.Token;
22 import com.google.dart.engine.source.Source; 23 import com.google.dart.engine.source.Source;
23 24
24 /** 25 /**
25 * Instances of the class {@code ErrorReporter} wrap an error listener with util ity methods used to 26 * Instances of the class {@code ErrorReporter} wrap an error listener with util ity methods used to
26 * create the errors being reported. 27 * create the errors being reported.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 * @param arguments the arguments to the error, used to compose the error mess age 95 * @param arguments the arguments to the error, used to compose the error mess age
95 */ 96 */
96 public void reportError(ErrorCode errorCode, ASTNode node, Object... arguments ) { 97 public void reportError(ErrorCode errorCode, ASTNode node, Object... arguments ) {
97 reportError(errorCode, node.getOffset(), node.getLength(), arguments); 98 reportError(errorCode, node.getOffset(), node.getLength(), arguments);
98 } 99 }
99 100
100 /** 101 /**
101 * Report an error with the given error code and arguments. 102 * Report an error with the given error code and arguments.
102 * 103 *
103 * @param errorCode the error code of the error to be reported 104 * @param errorCode the error code of the error to be reported
105 * @param element the element which name should be used as the location of the error
106 * @param arguments the arguments to the error, used to compose the error mess age
107 */
108 public void reportError(ErrorCode errorCode, Element element, Object... argume nts) {
109 reportError(errorCode, element.getNameOffset(), element.getDisplayName().len gth(), arguments);
110 }
111
112 /**
113 * Report an error with the given error code and arguments.
114 *
115 * @param errorCode the error code of the error to be reported
104 * @param offset the offset of the location of the error 116 * @param offset the offset of the location of the error
105 * @param length the length of the location of the error 117 * @param length the length of the location of the error
106 * @param arguments the arguments to the error, used to compose the error mess age 118 * @param arguments the arguments to the error, used to compose the error mess age
107 */ 119 */
108 public void reportError(ErrorCode errorCode, int offset, int length, Object... arguments) { 120 public void reportError(ErrorCode errorCode, int offset, int length, Object... arguments) {
109 errorListener.onError(new AnalysisError(source, offset, length, errorCode, a rguments)); 121 errorListener.onError(new AnalysisError(source, offset, length, errorCode, a rguments));
110 } 122 }
111 123
112 /** 124 /**
113 * Report an error with the given error code and arguments. 125 * Report an error with the given error code and arguments.
114 * 126 *
115 * @param errorCode the error code of the error to be reported 127 * @param errorCode the error code of the error to be reported
116 * @param token the token specifying the location of the error 128 * @param token the token specifying the location of the error
117 * @param arguments the arguments to the error, used to compose the error mess age 129 * @param arguments the arguments to the error, used to compose the error mess age
118 */ 130 */
119 public void reportError(ErrorCode errorCode, Token token, Object... arguments) { 131 public void reportError(ErrorCode errorCode, Token token, Object... arguments) {
120 reportError(errorCode, token.getOffset(), token.getLength(), arguments); 132 reportError(errorCode, token.getOffset(), token.getLength(), arguments);
121 } 133 }
122 134
123 /** 135 /**
124 * Set the source to be used when reporting errors. Setting the source to {@co de null} will cause 136 * Set the source to be used when reporting errors. Setting the source to {@co de null} will cause
125 * the default source to be used. 137 * the default source to be used.
126 * 138 *
127 * @param source the source to be used when reporting errors 139 * @param source the source to be used when reporting errors
128 */ 140 */
129 public void setSource(Source source) { 141 public void setSource(Source source) {
130 this.source = source == null ? defaultSource : source; 142 this.source = source == null ? defaultSource : source;
131 } 143 }
132 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698