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

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

Issue 2651773003: Add summary support to CL 2647833002.
Patch Set: Clean up Created 3 years, 11 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
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 summary_resynthesizer; 5 library summary_resynthesizer;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 10 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 return typeArguments; 1400 return typeArguments;
1401 } 1401 }
1402 } 1402 }
1403 1403
1404 class _ResynthesizerContext implements ResynthesizerContext { 1404 class _ResynthesizerContext implements ResynthesizerContext {
1405 final _UnitResynthesizer _unitResynthesizer; 1405 final _UnitResynthesizer _unitResynthesizer;
1406 1406
1407 _ResynthesizerContext(this._unitResynthesizer); 1407 _ResynthesizerContext(this._unitResynthesizer);
1408 1408
1409 @override 1409 @override
1410 bool get isStrongMode => _unitResynthesizer.summaryResynthesizer.strongMode;
1411
1412 @override
1410 ElementAnnotationImpl buildAnnotation(ElementImpl context, UnlinkedExpr uc) { 1413 ElementAnnotationImpl buildAnnotation(ElementImpl context, UnlinkedExpr uc) {
1411 return _unitResynthesizer.buildAnnotation(context, uc); 1414 return _unitResynthesizer.buildAnnotation(context, uc);
1412 } 1415 }
1413 1416
1414 @override 1417 @override
1415 Expression buildExpression(ElementImpl context, UnlinkedExpr uc) { 1418 Expression buildExpression(ElementImpl context, UnlinkedExpr uc) {
1416 return _unitResynthesizer._buildConstExpression(context, uc); 1419 return _unitResynthesizer._buildConstExpression(context, uc);
1417 } 1420 }
1418 1421
1419 @override 1422 @override
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 String identifier = _getElementIdentifier(name, linkedReference.kind); 1771 String identifier = _getElementIdentifier(name, linkedReference.kind);
1769 locationComponents = 1772 locationComponents =
1770 enclosingInfo.element.location.components.toList(); 1773 enclosingInfo.element.location.components.toList();
1771 locationComponents.add(identifier); 1774 locationComponents.add(identifier);
1772 } else { 1775 } else {
1773 String identifier = _getElementIdentifier(name, linkedReference.kind); 1776 String identifier = _getElementIdentifier(name, linkedReference.kind);
1774 locationComponents = 1777 locationComponents =
1775 libraryResynthesizer.getReferencedLocationComponents( 1778 libraryResynthesizer.getReferencedLocationComponents(
1776 linkedReference.dependency, linkedReference.unit, identifier); 1779 linkedReference.dependency, linkedReference.unit, identifier);
1777 } 1780 }
1781 if (!_resynthesizerContext.isStrongMode &&
1782 locationComponents.length == 3 &&
1783 locationComponents[0] == 'dart:async' &&
1784 locationComponents[2] == 'FutureOr') {
1785 type = typeProvider.dynamicType;
1786 numTypeParameters = 0;
1787 }
1778 ElementLocation location = 1788 ElementLocation location =
1779 new ElementLocationImpl.con3(locationComponents); 1789 new ElementLocationImpl.con3(locationComponents);
1780 if (enclosingInfo != null) { 1790 if (enclosingInfo != null) {
1781 numTypeParameters += enclosingInfo.numTypeParameters; 1791 numTypeParameters += enclosingInfo.numTypeParameters;
1782 } 1792 }
1783 switch (linkedReference.kind) { 1793 switch (linkedReference.kind) {
1784 case ReferenceKind.classOrEnum: 1794 case ReferenceKind.classOrEnum:
1785 element = new ClassElementHandle(summaryResynthesizer, location); 1795 element = new ClassElementHandle(summaryResynthesizer, location);
1786 break; 1796 break;
1787 case ReferenceKind.constructor: 1797 case ReferenceKind.constructor:
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 static String _getElementIdentifier(String name, ReferenceKind kind) { 1927 static String _getElementIdentifier(String name, ReferenceKind kind) {
1918 if (kind == ReferenceKind.topLevelPropertyAccessor || 1928 if (kind == ReferenceKind.topLevelPropertyAccessor ||
1919 kind == ReferenceKind.propertyAccessor) { 1929 kind == ReferenceKind.propertyAccessor) {
1920 if (!name.endsWith('=')) { 1930 if (!name.endsWith('=')) {
1921 return name + '?'; 1931 return name + '?';
1922 } 1932 }
1923 } 1933 }
1924 return name; 1934 return name;
1925 } 1935 }
1926 } 1936 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698