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

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

Issue 16611004: Improve java2dart code style - relax 'don't reference variable name in its initializer'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine; 3 library engine;
4 import 'dart:collection' show HasNextIterator; 4 import 'dart:collection' show HasNextIterator;
5 import 'java_core.dart'; 5 import 'java_core.dart';
6 import 'java_engine.dart'; 6 import 'java_engine.dart';
7 import 'instrumentation.dart'; 7 import 'instrumentation.dart';
8 import 'error.dart'; 8 import 'error.dart';
9 import 'source.dart'; 9 import 'source.dart';
10 import 'scanner.dart' show Token, CharBufferScanner, StringScanner; 10 import 'scanner.dart' show Token, CharBufferScanner, StringScanner;
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 mapEntry.setValue(dartCopy); 1912 mapEntry.setValue(dartCopy);
1913 } 1913 }
1914 } 1914 }
1915 } 1915 }
1916 } 1916 }
1917 } 1917 }
1918 String computeDocumentationComment(Element element) { 1918 String computeDocumentationComment(Element element) {
1919 if (element == null) { 1919 if (element == null) {
1920 return null; 1920 return null;
1921 } 1921 }
1922 Source source2 = element.source; 1922 Source source = element.source;
1923 if (source2 == null) { 1923 if (source == null) {
1924 return null; 1924 return null;
1925 } 1925 }
1926 List<CharSequence> contentHolder = new List<CharSequence>(1); 1926 List<CharSequence> contentHolder = new List<CharSequence>(1);
1927 try { 1927 try {
1928 source2.getContents(new Source_ContentReceiver_6(contentHolder)); 1928 source.getContents(new Source_ContentReceiver_6(contentHolder));
1929 } catch (exception) { 1929 } catch (exception) {
1930 throw new AnalysisException.con2("Could not get contents of ${source2.full Name}", exception); 1930 throw new AnalysisException.con2("Could not get contents of ${source.fullN ame}", exception);
1931 } 1931 }
1932 if (contentHolder[0] == null) { 1932 if (contentHolder[0] == null) {
1933 return null; 1933 return null;
1934 } 1934 }
1935 CompilationUnit unit = parseCompilationUnit(source2); 1935 CompilationUnit unit = parseCompilationUnit(source);
1936 if (unit == null) { 1936 if (unit == null) {
1937 return null; 1937 return null;
1938 } 1938 }
1939 NodeLocator locator = new NodeLocator.con1(element.nameOffset); 1939 NodeLocator locator = new NodeLocator.con1(element.nameOffset);
1940 ASTNode nameNode = locator.searchWithin(unit); 1940 ASTNode nameNode = locator.searchWithin(unit);
1941 while (nameNode != null) { 1941 while (nameNode != null) {
1942 if (nameNode is AnnotatedNode) { 1942 if (nameNode is AnnotatedNode) {
1943 Comment comment = ((nameNode as AnnotatedNode)).documentationComment; 1943 Comment comment = ((nameNode as AnnotatedNode)).documentationComment;
1944 if (comment == null) { 1944 if (comment == null) {
1945 return null; 1945 return null;
1946 } 1946 }
1947 int offset2 = comment.offset; 1947 int offset = comment.offset;
1948 return contentHolder[0].subSequence(offset2, offset2 + comment.length).t oString(); 1948 return contentHolder[0].subSequence(offset, offset + comment.length).toS tring();
1949 } 1949 }
1950 nameNode = nameNode.parent; 1950 nameNode = nameNode.parent;
1951 } 1951 }
1952 return null; 1952 return null;
1953 } 1953 }
1954 List<AnalysisError> computeErrors(Source source) { 1954 List<AnalysisError> computeErrors(Source source) {
1955 { 1955 {
1956 SourceEntry sourceEntry = getSourceEntry(source); 1956 SourceEntry sourceEntry = getSourceEntry(source);
1957 if (sourceEntry is DartEntry) { 1957 if (sourceEntry is DartEntry) {
1958 DartEntry dartEntry = sourceEntry as DartEntry; 1958 DartEntry dartEntry = sourceEntry as DartEntry;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 if (container.contains(source)) { 2094 if (container.contains(source)) {
2095 sourcesToRemove.add(source); 2095 sourcesToRemove.add(source);
2096 newContext.addSourceInfo(source, entry.getValue().writableCopy); 2096 newContext.addSourceInfo(source, entry.getValue().writableCopy);
2097 } 2097 }
2098 } 2098 }
2099 } 2099 }
2100 return newContext; 2100 return newContext;
2101 } 2101 }
2102 AnalysisOptions get analysisOptions => _options; 2102 AnalysisOptions get analysisOptions => _options;
2103 Element getElement(ElementLocation location) { 2103 Element getElement(ElementLocation location) {
2104 List<String> components2 = ((location as ElementLocationImpl)).components; 2104 List<String> components = ((location as ElementLocationImpl)).components;
2105 ElementImpl element; 2105 ElementImpl element;
2106 { 2106 {
2107 Source librarySource = _sourceFactory.fromEncoding(components2[0]); 2107 Source librarySource = _sourceFactory.fromEncoding(components[0]);
2108 try { 2108 try {
2109 element = computeLibraryElement(librarySource) as ElementImpl; 2109 element = computeLibraryElement(librarySource) as ElementImpl;
2110 } on AnalysisException catch (exception) { 2110 } on AnalysisException catch (exception) {
2111 return null; 2111 return null;
2112 } 2112 }
2113 } 2113 }
2114 for (int i = 1; i < components2.length; i++) { 2114 for (int i = 1; i < components.length; i++) {
2115 if (element == null) { 2115 if (element == null) {
2116 return null; 2116 return null;
2117 } 2117 }
2118 element = element.getChild(components2[i]); 2118 element = element.getChild(components[i]);
2119 } 2119 }
2120 return element; 2120 return element;
2121 } 2121 }
2122 AnalysisErrorInfo getErrors(Source source) { 2122 AnalysisErrorInfo getErrors(Source source) {
2123 SourceEntry sourceEntry = getReadableSourceEntry(source); 2123 SourceEntry sourceEntry = getReadableSourceEntry(source);
2124 if (sourceEntry is DartEntry) { 2124 if (sourceEntry is DartEntry) {
2125 DartEntry dartEntry = sourceEntry as DartEntry; 2125 DartEntry dartEntry = sourceEntry as DartEntry;
2126 return new AnalysisErrorInfoImpl(dartEntry.allErrors, dartEntry.getValue(S ourceEntry.LINE_INFO)); 2126 return new AnalysisErrorInfoImpl(dartEntry.allErrors, dartEntry.getValue(S ourceEntry.LINE_INFO));
2127 } else if (sourceEntry is HtmlEntry) { 2127 } else if (sourceEntry is HtmlEntry) {
2128 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; 2128 HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 } 2239 }
2240 List<Source> get librarySources => getSources(SourceKind.LIBRARY); 2240 List<Source> get librarySources => getSources(SourceKind.LIBRARY);
2241 LineInfo getLineInfo(Source source) { 2241 LineInfo getLineInfo(Source source) {
2242 SourceEntry sourceEntry = getReadableSourceEntry(source); 2242 SourceEntry sourceEntry = getReadableSourceEntry(source);
2243 if (sourceEntry != null) { 2243 if (sourceEntry != null) {
2244 return sourceEntry.getValue(SourceEntry.LINE_INFO); 2244 return sourceEntry.getValue(SourceEntry.LINE_INFO);
2245 } 2245 }
2246 return null; 2246 return null;
2247 } 2247 }
2248 Namespace getPublicNamespace(LibraryElement library) { 2248 Namespace getPublicNamespace(LibraryElement library) {
2249 Source source2 = library.definingCompilationUnit.source; 2249 Source source = library.definingCompilationUnit.source;
2250 { 2250 {
2251 DartEntry dartEntry = getDartEntry(source2); 2251 DartEntry dartEntry = getDartEntry(source);
2252 if (dartEntry == null) { 2252 if (dartEntry == null) {
2253 return null; 2253 return null;
2254 } 2254 }
2255 Namespace namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); 2255 Namespace namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE);
2256 if (namespace == null) { 2256 if (namespace == null) {
2257 NamespaceBuilder builder = new NamespaceBuilder(); 2257 NamespaceBuilder builder = new NamespaceBuilder();
2258 namespace = builder.createPublicNamespace(library); 2258 namespace = builder.createPublicNamespace(library);
2259 DartEntryImpl dartCopy = dartEntry.writableCopy; 2259 DartEntryImpl dartCopy = dartEntry.writableCopy;
2260 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); 2260 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace);
2261 _sourceMap[source2] = dartCopy; 2261 _sourceMap[source] = dartCopy;
2262 } 2262 }
2263 return namespace; 2263 return namespace;
2264 } 2264 }
2265 } 2265 }
2266 Namespace getPublicNamespace2(Source source) { 2266 Namespace getPublicNamespace2(Source source) {
2267 { 2267 {
2268 DartEntry dartEntry = getDartEntry(source); 2268 DartEntry dartEntry = getDartEntry(source);
2269 if (dartEntry == null) { 2269 if (dartEntry == null) {
2270 return null; 2270 return null;
2271 } 2271 }
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 dartCopy.setValue(DartEntry.INCLUDED_PARTS, new List.from(unitSources)); 3068 dartCopy.setValue(DartEntry.INCLUDED_PARTS, new List.from(unitSources));
3069 } 3069 }
3070 3070
3071 /** 3071 /**
3072 * Record the result of using the given resolver to resolve one or more librar ies. 3072 * Record the result of using the given resolver to resolve one or more librar ies.
3073 * @param resolver the resolver that has the needed results 3073 * @param resolver the resolver that has the needed results
3074 * @throws AnalysisException if the results cannot be retrieved for some reaso n 3074 * @throws AnalysisException if the results cannot be retrieved for some reaso n
3075 */ 3075 */
3076 void recordResolutionResults(LibraryResolver resolver) { 3076 void recordResolutionResults(LibraryResolver resolver) {
3077 Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML); 3077 Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML);
3078 RecordingErrorListener errorListener2 = resolver.errorListener; 3078 RecordingErrorListener errorListener = resolver.errorListener;
3079 for (Library library in resolver.resolvedLibraries) { 3079 for (Library library in resolver.resolvedLibraries) {
3080 Source librarySource2 = library.librarySource; 3080 Source librarySource = library.librarySource;
3081 Set<Source> referencedLibraries = new Set<Source>(); 3081 Set<Source> referencedLibraries = new Set<Source>();
3082 for (Library referencedLibrary in library.exports) { 3082 for (Library referencedLibrary in library.exports) {
3083 javaSetAdd(referencedLibraries, referencedLibrary.librarySource); 3083 javaSetAdd(referencedLibraries, referencedLibrary.librarySource);
3084 } 3084 }
3085 for (Library referencedLibrary in library.imports) { 3085 for (Library referencedLibrary in library.imports) {
3086 javaSetAdd(referencedLibraries, referencedLibrary.librarySource); 3086 javaSetAdd(referencedLibraries, referencedLibrary.librarySource);
3087 } 3087 }
3088 for (Source source in library.compilationUnitSources) { 3088 for (Source source in library.compilationUnitSources) {
3089 CompilationUnit unit = library.getAST(source); 3089 CompilationUnit unit = library.getAST(source);
3090 List<AnalysisError> errors = errorListener2.getErrors2(source); 3090 List<AnalysisError> errors = errorListener.getErrors2(source);
3091 unit.resolutionErrors = errors; 3091 unit.resolutionErrors = errors;
3092 LineInfo lineInfo2 = unit.lineInfo; 3092 LineInfo lineInfo = unit.lineInfo;
3093 { 3093 {
3094 DartEntry dartEntry = getDartEntry(source); 3094 DartEntry dartEntry = getDartEntry(source);
3095 if (dartEntry != null) { 3095 if (dartEntry != null) {
3096 DartEntryImpl dartCopy = dartEntry.writableCopy; 3096 DartEntryImpl dartCopy = dartEntry.writableCopy;
3097 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo2); 3097 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
3098 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); 3098 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED);
3099 dartCopy.setValue2(DartEntry.RESOLVED_UNIT, librarySource2, unit); 3099 dartCopy.setValue2(DartEntry.RESOLVED_UNIT, librarySource, unit);
3100 dartCopy.setValue2(DartEntry.RESOLUTION_ERRORS, librarySource2, erro rs); 3100 dartCopy.setValue2(DartEntry.RESOLUTION_ERRORS, librarySource, error s);
3101 if (identical(source, librarySource2)) { 3101 if (identical(source, librarySource)) {
3102 recordElementData(dartCopy, library.libraryElement, htmlSource); 3102 recordElementData(dartCopy, library.libraryElement, htmlSource);
3103 List<Source> libraries; 3103 List<Source> libraries;
3104 if (referencedLibraries.isEmpty) { 3104 if (referencedLibraries.isEmpty) {
3105 libraries = Source.EMPTY_ARRAY; 3105 libraries = Source.EMPTY_ARRAY;
3106 } else { 3106 } else {
3107 libraries = new List.from(referencedLibraries); 3107 libraries = new List.from(referencedLibraries);
3108 } 3108 }
3109 dartCopy.setValue(DartEntry.REFERENCED_LIBRARIES, libraries); 3109 dartCopy.setValue(DartEntry.REFERENCED_LIBRARIES, libraries);
3110 } 3110 }
3111 _sourceMap[source] = dartCopy; 3111 _sourceMap[source] = dartCopy;
3112 ChangeNoticeImpl notice = getNotice(source); 3112 ChangeNoticeImpl notice = getNotice(source);
3113 notice.compilationUnit = unit; 3113 notice.compilationUnit = unit;
3114 notice.setErrors(dartCopy.allErrors, lineInfo2); 3114 notice.setErrors(dartCopy.allErrors, lineInfo);
3115 } 3115 }
3116 } 3116 }
3117 } 3117 }
3118 } 3118 }
3119 } 3119 }
3120 HtmlScanResult scanHtml(Source source) { 3120 HtmlScanResult scanHtml(Source source) {
3121 HtmlScanner scanner = new HtmlScanner(source); 3121 HtmlScanner scanner = new HtmlScanner(source);
3122 try { 3122 try {
3123 source.getContents(scanner); 3123 source.getContents(scanner);
3124 } catch (exception) { 3124 } catch (exception) {
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
3622 } 3622 }
3623 List<Source> get librarySources => ArrayUtils.addAll(super.librarySources, _sd kAnalysisContext.librarySources); 3623 List<Source> get librarySources => ArrayUtils.addAll(super.librarySources, _sd kAnalysisContext.librarySources);
3624 LineInfo getLineInfo(Source source) { 3624 LineInfo getLineInfo(Source source) {
3625 if (source.isInSystemLibrary()) { 3625 if (source.isInSystemLibrary()) {
3626 return _sdkAnalysisContext.getLineInfo(source); 3626 return _sdkAnalysisContext.getLineInfo(source);
3627 } else { 3627 } else {
3628 return super.getLineInfo(source); 3628 return super.getLineInfo(source);
3629 } 3629 }
3630 } 3630 }
3631 Namespace getPublicNamespace(LibraryElement library) { 3631 Namespace getPublicNamespace(LibraryElement library) {
3632 Source source2 = library.source; 3632 Source source = library.source;
3633 if (source2.isInSystemLibrary()) { 3633 if (source.isInSystemLibrary()) {
3634 return _sdkAnalysisContext.getPublicNamespace(library); 3634 return _sdkAnalysisContext.getPublicNamespace(library);
3635 } else { 3635 } else {
3636 return super.getPublicNamespace(library); 3636 return super.getPublicNamespace(library);
3637 } 3637 }
3638 } 3638 }
3639 Namespace getPublicNamespace2(Source source) { 3639 Namespace getPublicNamespace2(Source source) {
3640 if (source.isInSystemLibrary()) { 3640 if (source.isInSystemLibrary()) {
3641 return _sdkAnalysisContext.getPublicNamespace2(source); 3641 return _sdkAnalysisContext.getPublicNamespace2(source);
3642 } else { 3642 } else {
3643 return super.getPublicNamespace2(source); 3643 return super.getPublicNamespace2(source);
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
4289 for (AnalysisError error in listener.errors) { 4289 for (AnalysisError error in listener.errors) {
4290 onError(error); 4290 onError(error);
4291 } 4291 }
4292 } 4292 }
4293 4293
4294 /** 4294 /**
4295 * Answer the errors collected by the listener. 4295 * Answer the errors collected by the listener.
4296 * @return an array of errors (not {@code null}, contains no {@code null}s) 4296 * @return an array of errors (not {@code null}, contains no {@code null}s)
4297 */ 4297 */
4298 List<AnalysisError> get errors { 4298 List<AnalysisError> get errors {
4299 Set<MapEntry<Source, List<AnalysisError>>> entrySet2 = getMapEntrySet(_error s); 4299 Set<MapEntry<Source, List<AnalysisError>>> entrySet = getMapEntrySet(_errors );
4300 if (entrySet2.length == 0) { 4300 if (entrySet.length == 0) {
4301 return AnalysisError.NO_ERRORS; 4301 return AnalysisError.NO_ERRORS;
4302 } 4302 }
4303 List<AnalysisError> resultList = new List<AnalysisError>(); 4303 List<AnalysisError> resultList = new List<AnalysisError>();
4304 for (MapEntry<Source, List<AnalysisError>> entry in entrySet2) { 4304 for (MapEntry<Source, List<AnalysisError>> entry in entrySet) {
4305 resultList.addAll(entry.getValue()); 4305 resultList.addAll(entry.getValue());
4306 } 4306 }
4307 return new List.from(resultList); 4307 return new List.from(resultList);
4308 } 4308 }
4309 4309
4310 /** 4310 /**
4311 * Answer the errors collected by the listener for some passed {@link Source}. 4311 * Answer the errors collected by the listener for some passed {@link Source}.
4312 * @param source some {@link Source} for which the caller wants the set of {@l ink AnalysisError}s 4312 * @param source some {@link Source} for which the caller wants the set of {@l ink AnalysisError}s
4313 * collected by this listener 4313 * collected by this listener
4314 * @return the errors collected by the listener for the passed {@link Source} 4314 * @return the errors collected by the listener for the passed {@link Source}
4315 */ 4315 */
4316 List<AnalysisError> getErrors2(Source source) { 4316 List<AnalysisError> getErrors2(Source source) {
4317 List<AnalysisError> errorsForSource = _errors[source]; 4317 List<AnalysisError> errorsForSource = _errors[source];
4318 if (errorsForSource == null) { 4318 if (errorsForSource == null) {
4319 return AnalysisError.NO_ERRORS; 4319 return AnalysisError.NO_ERRORS;
4320 } else { 4320 } else {
4321 return new List.from(errorsForSource); 4321 return new List.from(errorsForSource);
4322 } 4322 }
4323 } 4323 }
4324 void onError(AnalysisError event) { 4324 void onError(AnalysisError event) {
4325 Source source2 = event.source; 4325 Source source = event.source;
4326 List<AnalysisError> errorsForSource = _errors[source2]; 4326 List<AnalysisError> errorsForSource = _errors[source];
4327 if (_errors[source2] == null) { 4327 if (_errors[source] == null) {
4328 errorsForSource = new List<AnalysisError>(); 4328 errorsForSource = new List<AnalysisError>();
4329 _errors[source2] = errorsForSource; 4329 _errors[source] = errorsForSource;
4330 } 4330 }
4331 errorsForSource.add(event); 4331 errorsForSource.add(event);
4332 } 4332 }
4333 } 4333 }
4334 /** 4334 /**
4335 * Instances of the class {@code ResolutionEraser} remove any resolution informa tion from an AST 4335 * Instances of the class {@code ResolutionEraser} remove any resolution informa tion from an AST
4336 * structure when used to visit that structure. 4336 * structure when used to visit that structure.
4337 */ 4337 */
4338 class ResolutionEraser extends GeneralizingASTVisitor<Object> { 4338 class ResolutionEraser extends GeneralizingASTVisitor<Object> {
4339 Object visitAssignmentExpression(AssignmentExpression node) { 4339 Object visitAssignmentExpression(AssignmentExpression node) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
4453 } 4453 }
4454 void logError2(String message, Exception exception) { 4454 void logError2(String message, Exception exception) {
4455 } 4455 }
4456 void logError3(Exception exception) { 4456 void logError3(Exception exception) {
4457 } 4457 }
4458 void logInformation(String message) { 4458 void logInformation(String message) {
4459 } 4459 }
4460 void logInformation2(String message, Exception exception) { 4460 void logInformation2(String message, Exception exception) {
4461 } 4461 }
4462 } 4462 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/element.dart ('k') | pkg/analyzer_experimental/lib/src/generated/html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698