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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/sdk/SdkLibrariesReader.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) 2012, the Dart project authors. 2 * Copyright (c) 2012, 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.sdk; 14 package com.google.dart.engine.internal.sdk;
15 15
16 import com.google.dart.engine.ast.BooleanLiteral; 16 import com.google.dart.engine.ast.BooleanLiteral;
17 import com.google.dart.engine.ast.CompilationUnit; 17 import com.google.dart.engine.ast.CompilationUnit;
18 import com.google.dart.engine.ast.Expression; 18 import com.google.dart.engine.ast.Expression;
19 import com.google.dart.engine.ast.InstanceCreationExpression; 19 import com.google.dart.engine.ast.InstanceCreationExpression;
20 import com.google.dart.engine.ast.MapLiteralEntry; 20 import com.google.dart.engine.ast.MapLiteralEntry;
21 import com.google.dart.engine.ast.NamedExpression; 21 import com.google.dart.engine.ast.NamedExpression;
22 import com.google.dart.engine.ast.SimpleIdentifier; 22 import com.google.dart.engine.ast.SimpleIdentifier;
23 import com.google.dart.engine.ast.SimpleStringLiteral; 23 import com.google.dart.engine.ast.SimpleStringLiteral;
24 import com.google.dart.engine.ast.visitor.RecursiveASTVisitor; 24 import com.google.dart.engine.ast.visitor.RecursiveASTVisitor;
25 import com.google.dart.engine.error.AnalysisError; 25 import com.google.dart.engine.error.AnalysisError;
26 import com.google.dart.engine.error.AnalysisErrorListener; 26 import com.google.dart.engine.error.AnalysisErrorListener;
27 import com.google.dart.engine.error.ErrorType;
27 import com.google.dart.engine.parser.Parser; 28 import com.google.dart.engine.parser.Parser;
28 import com.google.dart.engine.scanner.CharSequenceReader; 29 import com.google.dart.engine.scanner.CharSequenceReader;
29 import com.google.dart.engine.scanner.Scanner; 30 import com.google.dart.engine.scanner.Scanner;
30 import com.google.dart.engine.source.FileBasedSource; 31 import com.google.dart.engine.source.FileBasedSource;
31 import com.google.dart.engine.source.Source; 32 import com.google.dart.engine.source.Source;
32 import com.google.dart.engine.source.UriKind; 33 import com.google.dart.engine.source.UriKind;
33 34
34 import java.io.File; 35 import java.io.File;
35 import java.util.List; 36 import java.util.List;
36 37
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 /** 156 /**
156 * Return the library map read from the given source. 157 * Return the library map read from the given source.
157 * 158 *
158 * @return the library map read from the given source 159 * @return the library map read from the given source
159 */ 160 */
160 public LibraryMap readFrom(File librariesFile, String libraryFileContents) { 161 public LibraryMap readFrom(File librariesFile, String libraryFileContents) {
161 final boolean[] foundError = {false}; 162 final boolean[] foundError = {false};
162 AnalysisErrorListener errorListener = new AnalysisErrorListener() { 163 AnalysisErrorListener errorListener = new AnalysisErrorListener() {
163 @Override 164 @Override
164 public void onError(AnalysisError error) { 165 public void onError(AnalysisError error) {
165 foundError[0] = true; 166 // TODO (danrubel): Remove this TODO check once TODO scraping is moved o ut of parser
167 if (error != null && error.getErrorCode().getType() != ErrorType.TODO) {
168 foundError[0] = true;
169 }
166 } 170 }
167 }; 171 };
168 Source source = new FileBasedSource(null, librariesFile, UriKind.FILE_URI); 172 Source source = new FileBasedSource(null, librariesFile, UriKind.FILE_URI);
169 Scanner scanner = new Scanner( 173 Scanner scanner = new Scanner(
170 source, 174 source,
171 new CharSequenceReader(libraryFileContents), 175 new CharSequenceReader(libraryFileContents),
172 errorListener); 176 errorListener);
173 Parser parser = new Parser(source, errorListener); 177 Parser parser = new Parser(source, errorListener);
174 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); 178 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
175 LibraryBuilder libraryBuilder = new LibraryBuilder(); 179 LibraryBuilder libraryBuilder = new LibraryBuilder();
176 // If any syntactic errors were found then don't try to visit the AST struct ure. 180 // If any syntactic errors were found then don't try to visit the AST struct ure.
177 if (!foundError[0]) { 181 if (!foundError[0]) {
178 unit.accept(libraryBuilder); 182 unit.accept(libraryBuilder);
179 } 183 }
180 return libraryBuilder.getLibrariesMap(); 184 return libraryBuilder.getLibrariesMap();
181 } 185 }
182 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698