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

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

Issue 677663002: Support constructor invocation in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comment. Created 6 years, 1 month 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/modely.dart ('k') | pkg/analyzer2dart/lib/src/util.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.treeShaker; 5 library analyzer2dart.treeShaker;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // TODO(paulberry): deal with this situation. This can happen, for 254 // TODO(paulberry): deal with this situation. This can happen, for
255 // example, in the case "main() => new Unresolved();" (which is a 255 // example, in the case "main() => new Unresolved();" (which is a
256 // warning, not an error). 256 // warning, not an error).
257 } 257 }
258 super.visitInstanceCreationExpression(node); 258 super.visitInstanceCreationExpression(node);
259 } 259 }
260 260
261 @override 261 @override
262 void visitDynamicInvocation(MethodInvocation node, 262 void visitDynamicInvocation(MethodInvocation node,
263 AccessSemantics semantics) { 263 AccessSemantics semantics) {
264 analysis.invokes.add( 264 analysis.invokes.add(createSelectorFromMethodInvocation(
265 createSelectorFromMethodInvocation(node, node.methodName.name)); 265 node.argumentList, node.methodName.name));
266 } 266 }
267 267
268 @override 268 @override
269 void visitLocalFunctionInvocation(MethodInvocation node, 269 void visitLocalFunctionInvocation(MethodInvocation node,
270 AccessSemantics semantics) { 270 AccessSemantics semantics) {
271 // Locals don't need to be tree shaken. 271 // Locals don't need to be tree shaken.
272 } 272 }
273 273
274 @override 274 @override
275 void visitLocalVariableInvocation(MethodInvocation node, 275 void visitLocalVariableInvocation(MethodInvocation node,
276 AccessSemantics semantics) { 276 AccessSemantics semantics) {
277 // Locals don't need to be tree shaken. 277 // Locals don't need to be tree shaken.
278 } 278 }
279 279
280 @override 280 @override
281 void visitParameterInvocation(MethodInvocation node, 281 void visitParameterInvocation(MethodInvocation node,
282 AccessSemantics semantics) { 282 AccessSemantics semantics) {
283 // Locals don't need to be tree shaken. 283 // Locals don't need to be tree shaken.
284 } 284 }
285 285
286 @override 286 @override
287 void visitStaticFieldInvocation(MethodInvocation node, 287 void visitStaticFieldInvocation(MethodInvocation node,
288 AccessSemantics semantics) { 288 AccessSemantics semantics) {
289 // Invocation of a static field. 289 // Invocation of a static field.
290 analysis.accesses.add(semantics.element); 290 analysis.accesses.add(semantics.element);
291 analysis.invokes.add(createSelectorFromMethodInvocation(node, 'call')); 291 analysis.invokes.add(createSelectorFromMethodInvocation(
292 node.argumentList, 'call'));
292 } 293 }
293 294
294 void visitStaticMethodInvocation(MethodInvocation node, 295 void visitStaticMethodInvocation(MethodInvocation node,
295 AccessSemantics semantics) { 296 AccessSemantics semantics) {
296 analysis.calls.add(semantics.element); 297 analysis.calls.add(semantics.element);
297 } 298 }
298 299
299 void visitStaticPropertyInvocation(MethodInvocation node, 300 void visitStaticPropertyInvocation(MethodInvocation node,
300 AccessSemantics semantics) { 301 AccessSemantics semantics) {
301 // Invocation of a property. TODO(paulberry): handle this. 302 // Invocation of a property. TODO(paulberry): handle this.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 369
369 @override 370 @override
370 void 371 void
371 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod e) { 372 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod e) {
372 // Note: we don't have to worry about node.staticElement being 373 // Note: we don't have to worry about node.staticElement being
373 // null, because that would have been detected by the analyzer and 374 // null, because that would have been detected by the analyzer and
374 // reported as a compile time error. 375 // reported as a compile time error.
375 analysis.calls.add(node.staticElement); 376 analysis.calls.add(node.staticElement);
376 } 377 }
377 } 378 }
OLDNEW
« no previous file with comments | « pkg/analyzer2dart/lib/src/modely.dart ('k') | pkg/analyzer2dart/lib/src/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698