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

Side by Side Diff: pkg/analyzer2dart/lib/src/semantic_visitor.dart

Issue 669673006: Add SExpression test and share tests between dart2dart and analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 2 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
« no previous file with comments | « pkg/analyzer2dart/lib/src/cps_generator.dart ('k') | pkg/analyzer2dart/test/end2end_data.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer2dart.semantic_visitor; 5 library analyzer2dart.semantic_visitor;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/src/generated/source.dart'; 8 import 'package:analyzer/src/generated/source.dart';
9 9
10 import 'util.dart'; 10 import 'util.dart';
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 AccessSemantics semantics) { 70 AccessSemantics semantics) {
71 return giveUp(node, 'visitStaticPropertyInvocation of $semantics'); 71 return giveUp(node, 'visitStaticPropertyInvocation of $semantics');
72 } 72 }
73 73
74 @override 74 @override
75 R visitMethodInvocation(MethodInvocation node) { 75 R visitMethodInvocation(MethodInvocation node) {
76 if (node.target != null) { 76 if (node.target != null) {
77 node.target.accept(this); 77 node.target.accept(this);
78 } 78 }
79 node.argumentList.accept(this); 79 node.argumentList.accept(this);
80 return handleMethodInvocation(node);
81 }
82
83 R handleMethodInvocation(MethodInvocation node) {
80 AccessSemantics semantics = classifyMethodInvocation(node); 84 AccessSemantics semantics = classifyMethodInvocation(node);
81 switch (semantics.kind) { 85 switch (semantics.kind) {
82 case AccessKind.DYNAMIC: 86 case AccessKind.DYNAMIC:
83 return visitDynamicInvocation(node, semantics); 87 return visitDynamicInvocation(node, semantics);
84 case AccessKind.LOCAL_FUNCTION: 88 case AccessKind.LOCAL_FUNCTION:
85 return visitLocalFunctionInvocation(node, semantics); 89 return visitLocalFunctionInvocation(node, semantics);
86 case AccessKind.LOCAL_VARIABLE: 90 case AccessKind.LOCAL_VARIABLE:
87 return visitLocalVariableInvocation(node, semantics); 91 return visitLocalVariableInvocation(node, semantics);
88 case AccessKind.PARAMETER: 92 case AccessKind.PARAMETER:
89 return visitParameterInvocation(node, semantics); 93 return visitParameterInvocation(node, semantics);
90 case AccessKind.STATIC_FIELD: 94 case AccessKind.STATIC_FIELD:
91 return visitStaticFieldInvocation(node, semantics); 95 return visitStaticFieldInvocation(node, semantics);
92 case AccessKind.STATIC_METHOD: 96 case AccessKind.STATIC_METHOD:
93 return visitStaticMethodInvocation(node, semantics); 97 return visitStaticMethodInvocation(node, semantics);
94 case AccessKind.STATIC_PROPERTY: 98 case AccessKind.STATIC_PROPERTY:
95 return visitStaticPropertyInvocation(node, semantics); 99 return visitStaticPropertyInvocation(node, semantics);
96 default: 100 default:
97 // Unexpected access kind. 101 // Unexpected access kind.
98 return giveUp(node, 102 return giveUp(node,
99 'Unexpected ${semantics} in visitMethodInvocation.'); 103 'Unexpected ${semantics} in visitMethodInvocation.');
100 } 104 }
101 } 105 }
102 106
103 @override 107 @override
104 R visitPropertyAccess(PropertyAccess node) { 108 R visitPropertyAccess(PropertyAccess node) {
105 if (node.target != null) { 109 if (node.target != null) {
106 node.target.accept(this); 110 node.target.accept(this);
107 } 111 }
112 return handlePropertyAccess(node);
113 }
114
115 R handlePropertyAccess(PropertyAccess node) {
108 return _handlePropertyAccess(node, classifyPropertyAccess(node)); 116 return _handlePropertyAccess(node, classifyPropertyAccess(node));
109 } 117 }
110 118
111 @override 119 @override
112 R visitPrefixedIdentifier(PrefixedIdentifier node) { 120 R visitPrefixedIdentifier(PrefixedIdentifier node) {
113 node.prefix.accept(this); 121 node.prefix.accept(this);
122 return handlePrefixedIdentifier(node);
123 }
124
125 R handlePrefixedIdentifier(PrefixedIdentifier node) {
114 return _handlePropertyAccess(node, classifyPrefixedIdentifier(node)); 126 return _handlePropertyAccess(node, classifyPrefixedIdentifier(node));
115 } 127 }
116 128
117 @override 129 @override
118 R visitSimpleIdentifier(SimpleIdentifier node) { 130 R visitSimpleIdentifier(SimpleIdentifier node) {
119 AccessSemantics semantics = classifySimpleIdentifier(node); 131 AccessSemantics semantics = classifySimpleIdentifier(node);
120 if (semantics != null) { 132 if (semantics != null) {
121 return _handlePropertyAccess(node, semantics); 133 return _handlePropertyAccess(node, semantics);
122 } else { 134 } else {
123 return null; 135 return null;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return visitStaticMethodAccess(node, semantics); 180 return visitStaticMethodAccess(node, semantics);
169 case AccessKind.STATIC_PROPERTY: 181 case AccessKind.STATIC_PROPERTY:
170 return visitStaticPropertyAccess(node, semantics); 182 return visitStaticPropertyAccess(node, semantics);
171 default: 183 default:
172 // Unexpected access kind. 184 // Unexpected access kind.
173 return giveUp(node, 185 return giveUp(node,
174 'Unexpected ${semantics} in _handlePropertyAccess.'); 186 'Unexpected ${semantics} in _handlePropertyAccess.');
175 } 187 }
176 } 188 }
177 } 189 }
OLDNEW
« no previous file with comments | « pkg/analyzer2dart/lib/src/cps_generator.dart ('k') | pkg/analyzer2dart/test/end2end_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698