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

Side by Side Diff: pkg/analyzer/lib/src/summary/summary_sdk.dart

Issue 1712313002: Get LibraryElement(s) and CompilationUnitElement(s) from summary. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analyzer.src.summary.summary_sdk; 5 library analyzer.src.summary.summary_sdk;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/context/cache.dart' show CacheEntry; 9 import 'package:analyzer/src/context/cache.dart' show CacheEntry;
10 import 'package:analyzer/src/context/context.dart'; 10 import 'package:analyzer/src/context/context.dart';
11 import 'package:analyzer/src/dart/element/element.dart';
11 import 'package:analyzer/src/dart/element/type.dart'; 12 import 'package:analyzer/src/dart/element/type.dart';
12 import 'package:analyzer/src/generated/constant.dart'; 13 import 'package:analyzer/src/generated/constant.dart';
13 import 'package:analyzer/src/generated/engine.dart'; 14 import 'package:analyzer/src/generated/engine.dart';
14 import 'package:analyzer/src/generated/resolver.dart'; 15 import 'package:analyzer/src/generated/resolver.dart';
15 import 'package:analyzer/src/generated/source.dart' 16 import 'package:analyzer/src/generated/source.dart'
16 show DartUriResolver, Source, SourceFactory, SourceKind; 17 show DartUriResolver, Source, SourceFactory, SourceKind;
17 import 'package:analyzer/src/summary/idl.dart'; 18 import 'package:analyzer/src/summary/idl.dart';
18 import 'package:analyzer/src/summary/resynthesize.dart'; 19 import 'package:analyzer/src/summary/resynthesize.dart';
19 import 'package:analyzer/src/task/dart.dart'; 20 import 'package:analyzer/src/task/dart.dart';
20 import 'package:analyzer/task/dart.dart'; 21 import 'package:analyzer/task/dart.dart';
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 SourceKind kind = _getSourceKind(uri); 83 SourceKind kind = _getSourceKind(uri);
83 if (kind != null) { 84 if (kind != null) {
84 entry.setValue(result, kind, TargetedResult.EMPTY_LIST); 85 entry.setValue(result, kind, TargetedResult.EMPTY_LIST);
85 return true; 86 return true;
86 } 87 }
87 return false; 88 return false;
88 } else { 89 } else {
89 // throw new UnimplementedError('$result of $target'); 90 // throw new UnimplementedError('$result of $target');
90 } 91 }
91 } 92 }
93 if (target is LibrarySpecificUnit) {
94 if (result == COMPILATION_UNIT_ELEMENT) {
95 String uri1 = target.library.uri.toString();
96 String uri2 = target.unit.uri.toString();
97 CompilationUnitElement unit = resynthesizer
98 .getElement(new ElementLocationImpl.con3(<String>[uri1, uri2]));
99 if (unit != null) {
100 entry.setValue(result, unit, TargetedResult.EMPTY_LIST);
101 return true;
102 }
103 }
104 }
92 return false; 105 return false;
93 } 106 }
94 107
95 void _buildAsyncLibrary() { 108 void _buildAsyncLibrary() {
96 LibraryElement library = resynthesizer.getLibraryElement('dart:async'); 109 LibraryElement library = resynthesizer.getLibraryElement('dart:async');
97 typeProvider.initializeAsync(library); 110 typeProvider.initializeAsync(library);
98 } 111 }
99 112
100 void _buildCoreLibrary() { 113 void _buildCoreLibrary() {
101 LibraryElement library = resynthesizer.getLibraryElement('dart:core'); 114 LibraryElement library = resynthesizer.getLibraryElement('dart:core');
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 * throw a [StateError] if there is no class with the given name. 404 * throw a [StateError] if there is no class with the given name.
392 */ 405 */
393 InterfaceType _getType(LibraryElement library, String name) { 406 InterfaceType _getType(LibraryElement library, String name) {
394 Element element = library.getType(name); 407 Element element = library.getType(name);
395 if (element == null) { 408 if (element == null) {
396 throw new StateError("No definition of type $name"); 409 throw new StateError("No definition of type $name");
397 } 410 }
398 return (element as ClassElement).type; 411 return (element as ClassElement).type;
399 } 412 }
400 } 413 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698