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

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

Issue 1893703002: Support for a.b.c.d extract property sequence. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_ast_test.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /** 5 /**
6 * This library is capable of producing linked summaries from unlinked 6 * This library is capable of producing linked summaries from unlinked
7 * ones (or prelinked ones). It functions by building a miniature 7 * ones (or prelinked ones). It functions by building a miniature
8 * element model to represent the contents of the summaries, and then 8 * element model to represent the contents of the summaries, and then
9 * scanning the element model to gather linked information and adding 9 * scanning the element model to gather linked information and adding
10 * it to the summary data structures. 10 * it to the summary data structures.
(...skipping 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 3270
3271 @override 3271 @override
3272 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 3272 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
3273 } 3273 }
3274 3274
3275 /** 3275 /**
3276 * Element representing a getter or setter resynthesized from a summary during 3276 * Element representing a getter or setter resynthesized from a summary during
3277 * linking. 3277 * linking.
3278 */ 3278 */
3279 abstract class PropertyAccessorElementForLink 3279 abstract class PropertyAccessorElementForLink
3280 implements PropertyAccessorElementImpl { 3280 implements PropertyAccessorElementImpl, ReferenceableElementForLink {
3281 void link(CompilationUnitElementInBuildUnit compilationUnit); 3281 void link(CompilationUnitElementInBuildUnit compilationUnit);
3282 } 3282 }
3283 3283
3284 /** 3284 /**
3285 * Specialization of [PropertyAccessorElementForLink] for non-synthetic 3285 * Specialization of [PropertyAccessorElementForLink] for non-synthetic
3286 * accessors explicitly declared in the source code. 3286 * accessors explicitly declared in the source code.
3287 */ 3287 */
3288 class PropertyAccessorElementForLink_Executable extends ExecutableElementForLink 3288 class PropertyAccessorElementForLink_Executable extends ExecutableElementForLink
3289 implements PropertyAccessorElementForLink { 3289 implements PropertyAccessorElementForLink {
3290 @override 3290 @override
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3327 implements PropertyAccessorElementForLink { 3327 implements PropertyAccessorElementForLink {
3328 @override 3328 @override
3329 final bool isSetter; 3329 final bool isSetter;
3330 3330
3331 final VariableElementForLink _variable; 3331 final VariableElementForLink _variable;
3332 FunctionTypeImpl _type; 3332 FunctionTypeImpl _type;
3333 3333
3334 PropertyAccessorElementForLink_Variable(this._variable, this.isSetter); 3334 PropertyAccessorElementForLink_Variable(this._variable, this.isSetter);
3335 3335
3336 @override 3336 @override
3337 DartType get asStaticType => returnType;
3338
3339 @override
3340 TypeInferenceNode get asTypeInferenceNode {
3341 // TODO(scheglov) is this correct?
Paul Berry 2016/04/15 21:15:52 Yes, I believe this is correct, but only because o
3342 return null;
3343 }
3344
3345 @override
3337 Element get enclosingElement => _variable.enclosingElement; 3346 Element get enclosingElement => _variable.enclosingElement;
3338 3347
3339 @override 3348 @override
3340 bool get isGetter => !isSetter; 3349 bool get isGetter => !isSetter;
3341 3350
3342 @override 3351 @override
3343 bool get isStatic => _variable.isStatic; 3352 bool get isStatic => _variable.isStatic;
3344 3353
3345 @override 3354 @override
3346 bool get isSynthetic => true; 3355 bool get isSynthetic => true;
(...skipping 27 matching lines...) Expand all
3374 3383
3375 @override 3384 @override
3376 FunctionTypeImpl get type => _type ??= new FunctionTypeImpl(this); 3385 FunctionTypeImpl get type => _type ??= new FunctionTypeImpl(this);
3377 3386
3378 @override 3387 @override
3379 List<TypeParameterElement> get typeParameters { 3388 List<TypeParameterElement> get typeParameters {
3380 // TODO(paulberry): is this correct for fields in generic classes? 3389 // TODO(paulberry): is this correct for fields in generic classes?
3381 return const []; 3390 return const [];
3382 } 3391 }
3383 3392
3393 ReferenceableElementForLink getContainedName(String name) {
3394 DartType type = returnType;
3395 if (type is InterfaceType) {
3396 PropertyAccessorElement getter =
3397 type.lookUpGetter(name, _variable.compilationUnit.library);
3398 print('getter: $getter');
Paul Berry 2016/04/15 21:15:52 Looks like temporary debugging code; should be rem
3399 if (getter is PropertyAccessorElementForLink) {
3400 return getter;
3401 }
3402 }
3403 return new NonstaticMemberElementForLink(null);
3404 }
3405
3384 @override 3406 @override
3385 bool isAccessibleIn(LibraryElement library) => 3407 bool isAccessibleIn(LibraryElement library) =>
3386 !Identifier.isPrivateName(name) || identical(this.library, library); 3408 !Identifier.isPrivateName(name) || identical(this.library, library);
3387 3409
3388 @override 3410 @override
3389 void link(CompilationUnitElementInBuildUnit compilationUnit) {} 3411 void link(CompilationUnitElementInBuildUnit compilationUnit) {}
3390 3412
3391 @override 3413 @override
3392 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 3414 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
3393 3415
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
4070 * there are no type parameters in scope. 4092 * there are no type parameters in scope.
4071 */ 4093 */
4072 TypeParameterizedElementForLink get _typeParameterContext; 4094 TypeParameterizedElementForLink get _typeParameterContext;
4073 4095
4074 @override 4096 @override
4075 DartType buildType(DartType getTypeArgument(int i), 4097 DartType buildType(DartType getTypeArgument(int i),
4076 List<int> implicitFunctionTypeIndices) => 4098 List<int> implicitFunctionTypeIndices) =>
4077 DynamicTypeImpl.instance; 4099 DynamicTypeImpl.instance;
4078 4100
4079 ReferenceableElementForLink getContainedName(String name) { 4101 ReferenceableElementForLink getContainedName(String name) {
4102 DartType type = asStaticType;
4103 if (type is InterfaceType) {
4104 PropertyAccessorElement getter =
4105 type.lookUpGetter(name, compilationUnit.library);
4106 if (getter is PropertyAccessorElementForLink) {
4107 return getter;
4108 }
4109 }
4080 return new NonstaticMemberElementForLink(_constNode); 4110 return new NonstaticMemberElementForLink(_constNode);
4081 } 4111 }
4082 4112
4083 @override 4113 @override
4084 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 4114 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
4085 } 4115 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698