@@ -2315,9 +2315,26 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
23152315 }
23162316
23172317 @override
2318- void visitDotShorthandPropertyAccess (DotShorthandPropertyAccess node,
2318+ void visitDotShorthandPropertyAccess (
2319+ covariant DotShorthandPropertyAccessImpl node,
23192320 {TypeImpl contextType = UnknownInferredType .instance}) {
2320- throw UnimplementedError ('TODO(kallentu)' );
2321+ inferenceLogWriter? .enterExpression (node, contextType);
2322+
2323+ // If [isDotShorthand] is set, cache the context type for resolution.
2324+ if (node.isDotShorthand) {
2325+ pushDotShorthandContext (SharedTypeSchemaView (contextType));
2326+ }
2327+
2328+ checkUnreachableNode (node);
2329+ var result = _propertyElementResolver.resolveDotShorthand (node);
2330+ _resolvePropertyAccessRhs_common (
2331+ result, node, node.propertyName, contextType);
2332+
2333+ if (node.isDotShorthand) {
2334+ popDotShorthandContext ();
2335+ }
2336+
2337+ inferenceLogWriter? .exitExpression (node);
23212338 }
23222339
23232340 @override
@@ -3982,21 +3999,34 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
39823999 hasWrite: false ,
39834000 );
39844001
3985- var element = result.readElement2;
4002+ _resolvePropertyAccessRhs_common (
4003+ result, node, node.propertyName, contextType);
4004+ nullSafetyDeadCodeVerifier.verifyPropertyAccess (node);
4005+ }
4006+
4007+ /// Common logic for resolving dot shorthands property accesses and
4008+ /// [_resolvePropertyAccessRhs] .
4009+ void _resolvePropertyAccessRhs_common (
4010+ PropertyElementResolverResult resolverResult,
4011+ ExpressionImpl node,
4012+ SimpleIdentifierImpl propertyName,
4013+ TypeImpl contextType) {
4014+ var element = resolverResult.readElement2;
39864015
3987- var propertyName = node.propertyName;
39884016 propertyName.element = element;
39894017
39904018 DartType type;
39914019 if (element is MethodElement2 ) {
39924020 type = element.type;
4021+ } else if (element is ConstructorElementImpl2 ) {
4022+ type = element.type;
39934023 } else if (element is GetterElement ) {
3994- type = result .getType! ;
3995- } else if (result .functionTypeCallType != null ) {
3996- type = result .functionTypeCallType! ;
3997- } else if (result .recordField != null ) {
3998- type = result .recordField! .type;
3999- } else if (result .atDynamicTarget) {
4024+ type = resolverResult .getType! ;
4025+ } else if (resolverResult .functionTypeCallType != null ) {
4026+ type = resolverResult .functionTypeCallType! ;
4027+ } else if (resolverResult .recordField != null ) {
4028+ type = resolverResult .recordField! .type;
4029+ } else if (resolverResult .atDynamicTarget) {
40004030 type = DynamicTypeImpl .instance;
40014031 } else {
40024032 type = InvalidTypeImpl .instance;
@@ -4020,7 +4050,6 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
40204050
40214051 nullShortingTermination (node, rewrittenExpression: replacement);
40224052 _insertImplicitCallReference (replacement, contextType: contextType);
4023- nullSafetyDeadCodeVerifier.verifyPropertyAccess (node);
40244053 }
40254054
40264055 /// Continues resolution of a [FunctionExpressionInvocation] that was created
0 commit comments