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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 1033383002: Gracefully handle IO exceptions while resolving URIs (issue 23023) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
11 import 'dart:async'; 11 import 'dart:async';
12 import 'dart:collection'; 12 import 'dart:collection';
13 13
14 import 'package:analyzer/src/cancelable_future.dart'; 14 import 'package:analyzer/src/cancelable_future.dart';
15 import 'package:analyzer/src/generated/incremental_resolution_validator.dart'; 15 import 'package:analyzer/src/generated/incremental_resolution_validator.dart';
16 import 'package:analyzer/src/plugin/engine_plugin.dart';
16 import 'package:analyzer/src/services/lint.dart'; 17 import 'package:analyzer/src/services/lint.dart';
17 import 'package:analyzer/src/task/task_dart.dart'; 18 import 'package:analyzer/src/task/task_dart.dart';
18 19
19 import '../../instrumentation/instrumentation.dart'; 20 import '../../instrumentation/instrumentation.dart';
20 import 'ast.dart'; 21 import 'ast.dart';
21 import 'constant.dart'; 22 import 'constant.dart';
22 import 'element.dart'; 23 import 'element.dart';
23 import 'error.dart'; 24 import 'error.dart';
24 import 'error_verifier.dart'; 25 import 'error_verifier.dart';
25 import 'html.dart' as ht; 26 import 'html.dart' as ht;
26 import 'incremental_resolver.dart' 27 import 'incremental_resolver.dart'
27 show IncrementalResolver, PoorMansIncrementalResolver; 28 show IncrementalResolver, PoorMansIncrementalResolver;
28 import 'incremental_scanner.dart'; 29 import 'incremental_scanner.dart';
29 import 'java_core.dart'; 30 import 'java_core.dart';
30 import 'java_engine.dart'; 31 import 'java_engine.dart';
31 import 'parser.dart' show Parser, IncrementalParser; 32 import 'parser.dart' show Parser, IncrementalParser;
32 import 'resolver.dart'; 33 import 'resolver.dart';
33 import 'scanner.dart'; 34 import 'scanner.dart';
34 import 'sdk.dart' show DartSdk; 35 import 'sdk.dart' show DartSdk;
35 import 'source.dart'; 36 import 'source.dart';
36 import 'utilities_collection.dart'; 37 import 'utilities_collection.dart';
37 import 'utilities_general.dart'; 38 import 'utilities_general.dart';
38 import 'package:analyzer/src/plugin/engine_plugin.dart';
39 39
40 /** 40 /**
41 * Used by [AnalysisOptions] to allow function bodies to be analyzed in some 41 * Used by [AnalysisOptions] to allow function bodies to be analyzed in some
42 * sources but not others. 42 * sources but not others.
43 */ 43 */
44 typedef bool AnalyzeFunctionBodiesPredicate(Source source); 44 typedef bool AnalyzeFunctionBodiesPredicate(Source source);
45 45
46 /** 46 /**
47 * Type of callback functions used by PendingFuture. Functions of this type 47 * Type of callback functions used by PendingFuture. Functions of this type
48 * should perform a computation based on the data in [sourceEntry] and return 48 * should perform a computation based on the data in [sourceEntry] and return
(...skipping 9346 matching lines...) Expand 10 before | Expand all | Expand 10 after
9395 UriBasedDirective directive, AnalysisErrorListener errorListener) { 9395 UriBasedDirective directive, AnalysisErrorListener errorListener) {
9396 StringLiteral uriLiteral = directive.uri; 9396 StringLiteral uriLiteral = directive.uri;
9397 String uriContent = uriLiteral.stringValue; 9397 String uriContent = uriLiteral.stringValue;
9398 if (uriContent != null) { 9398 if (uriContent != null) {
9399 uriContent = uriContent.trim(); 9399 uriContent = uriContent.trim();
9400 directive.uriContent = uriContent; 9400 directive.uriContent = uriContent;
9401 } 9401 }
9402 UriValidationCode code = directive.validate(); 9402 UriValidationCode code = directive.validate();
9403 if (code == null) { 9403 if (code == null) {
9404 String encodedUriContent = Uri.encodeFull(uriContent); 9404 String encodedUriContent = Uri.encodeFull(uriContent);
9405 Source source = 9405 try {
9406 context.sourceFactory.resolveUri(librarySource, encodedUriContent); 9406 Source source =
9407 directive.source = source; 9407 context.sourceFactory.resolveUri(librarySource, encodedUriContent);
9408 return source; 9408 directive.source = source;
9409 return source;
9410 } on JavaIOException {
9411 code = UriValidationCode.INVALID_URI;
9412 }
9409 } 9413 }
9410 if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) { 9414 if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) {
9411 return null; 9415 return null;
9412 } 9416 }
9413 if (code == UriValidationCode.URI_WITH_INTERPOLATION) { 9417 if (code == UriValidationCode.URI_WITH_INTERPOLATION) {
9414 errorListener.onError(new AnalysisError.con2(librarySource, 9418 errorListener.onError(new AnalysisError.con2(librarySource,
9415 uriLiteral.offset, uriLiteral.length, 9419 uriLiteral.offset, uriLiteral.length,
9416 CompileTimeErrorCode.URI_WITH_INTERPOLATION)); 9420 CompileTimeErrorCode.URI_WITH_INTERPOLATION));
9417 return null; 9421 return null;
9418 } 9422 }
(...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after
11639 visitElement(Element element) { 11643 visitElement(Element element) {
11640 if (element.id == _id) { 11644 if (element.id == _id) {
11641 result = element; 11645 result = element;
11642 throw new _ElementByIdFinderException(); 11646 throw new _ElementByIdFinderException();
11643 } 11647 }
11644 super.visitElement(element); 11648 super.visitElement(element);
11645 } 11649 }
11646 } 11650 }
11647 11651
11648 class _ElementByIdFinderException {} 11652 class _ElementByIdFinderException {}
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/engine_test.dart » ('j') | pkg/analyzer/test/generated/engine_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698