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

Side by Side Diff: pkg/compiler/lib/src/info/send_info.dart

Issue 1859343004: dartfmt pkg/compiler (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
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 /// Computes measurements about sends in a function. 5 /// Computes measurements about sends in a function.
6 library compiler.src.info.send_info; 6 library compiler.src.info.send_info;
7 7
8 import 'package:dart2js_info/src/measurements.dart'; 8 import 'package:dart2js_info/src/measurements.dart';
9 import 'package:dart2js_info/src/util.dart' show 9 import 'package:dart2js_info/src/util.dart' show recursiveDiagnosticString;
10 recursiveDiagnosticString;
11 10
12 import '../common.dart'; 11 import '../common.dart';
13 import '../compiler.dart' show 12 import '../compiler.dart' show Compiler;
14 Compiler;
15 import '../dart_types.dart'; 13 import '../dart_types.dart';
16 import '../closure.dart'; 14 import '../closure.dart';
17 import '../elements/elements.dart'; 15 import '../elements/elements.dart';
18 import '../elements/visitor.dart' show 16 import '../elements/visitor.dart' show ElementVisitor;
19 ElementVisitor;
20 import '../resolution/operators.dart'; 17 import '../resolution/operators.dart';
21 import '../resolution/semantic_visitor.dart'; 18 import '../resolution/semantic_visitor.dart';
22 import '../resolution/tree_elements.dart'; 19 import '../resolution/tree_elements.dart';
23 import '../constants/expressions.dart'; 20 import '../constants/expressions.dart';
24 import '../parser/partial_elements.dart' show 21 import '../parser/partial_elements.dart' show PartialElement;
25 PartialElement;
26 import '../tree/tree.dart'; 22 import '../tree/tree.dart';
27 import '../universe/call_structure.dart' show 23 import '../universe/call_structure.dart' show CallStructure;
28 CallStructure; 24 import '../universe/selector.dart' show Selector;
29 import '../universe/selector.dart' show
30 Selector;
31 25
32 import 'analysis_result.dart'; 26 import 'analysis_result.dart';
33 import 'naive_analysis_result.dart'; 27 import 'naive_analysis_result.dart';
34 import 'trusted_types_analysis_result.dart'; 28 import 'trusted_types_analysis_result.dart';
35 29
36 /// Collects a set of [Measurements] about send expressions in the function [f]. 30 /// Collects a set of [Measurements] about send expressions in the function [f].
37 // TODO(sigmund): collect information on initializers too. 31 // TODO(sigmund): collect information on initializers too.
38 Measurements collectSendMeasurements(FunctionElement f, 32 Measurements collectSendMeasurements(FunctionElement f, Compiler compiler) {
39 Compiler compiler) {
40 DiagnosticReporter reporter = compiler.reporter; 33 DiagnosticReporter reporter = compiler.reporter;
41 return reporter.withCurrentElement(f, () { 34 return reporter.withCurrentElement(f, () {
42 // TODO(sigmund): enable for platform too. 35 // TODO(sigmund): enable for platform too.
43 if (f.library.isPlatformLibrary) return null; 36 if (f.library.isPlatformLibrary) return null;
44 var name = _qualifiedName(f); 37 var name = _qualifiedName(f);
45 if (!f.hasNode) { 38 if (!f.hasNode) {
46 if (f is PartialElement) return const Measurements.unreachableFunction(); 39 if (f is PartialElement) return const Measurements.unreachableFunction();
47 assert (f is ConstructorElement && f.isSynthesized); 40 assert(f is ConstructorElement && f.isSynthesized);
48 // TODO(sigmund): measure synthethic forwarding sends, measure 41 // TODO(sigmund): measure synthethic forwarding sends, measure
49 // initializers 42 // initializers
50 return new Measurements.reachableFunction(); 43 return new Measurements.reachableFunction();
51 } 44 }
52 if (!f.hasResolvedAst) { 45 if (!f.hasResolvedAst) {
53 _debug('no resolved ast ${f.runtimeType}'); 46 _debug('no resolved ast ${f.runtimeType}');
54 return null; 47 return null;
55 } 48 }
56 var resolvedAst = f.resolvedAst; 49 var resolvedAst = f.resolvedAst;
57 if (resolvedAst.node == null) { 50 if (resolvedAst.node == null) {
58 _debug('no node ${f.runtimeType}'); 51 _debug('no node ${f.runtimeType}');
59 return null; 52 return null;
60 } 53 }
61 var def = resolvedAst.elements.getFunctionDefinition(resolvedAst.node); 54 var def = resolvedAst.elements.getFunctionDefinition(resolvedAst.node);
62 if (def == null) { 55 if (def == null) {
63 assert (f is PartialElement); 56 assert(f is PartialElement);
64 return const Measurements.unreachableFunction(); 57 return const Measurements.unreachableFunction();
65 } 58 }
66 59
67 var visitor = new _StatsTraversalVisitor( 60 var visitor = new _StatsTraversalVisitor(compiler, resolvedAst.elements,
68 compiler, resolvedAst.elements,
69 reporter.spanFromSpannable(resolvedAst.node).uri); 61 reporter.spanFromSpannable(resolvedAst.node).uri);
70 resolvedAst.node.accept(visitor); 62 resolvedAst.node.accept(visitor);
71 return visitor.measurements; 63 return visitor.measurements;
72 }); 64 });
73 } 65 }
74 66
75 _qualifiedName(FunctionElement f) { 67 _qualifiedName(FunctionElement f) {
76 var cls = f.enclosingClass; 68 var cls = f.enclosingClass;
77 return (cls != null) ? '${cls.name}.${f.name}' : f.name; 69 return (cls != null) ? '${cls.name}.${f.name}' : f.name;
78 } 70 }
79 71
80 /// Visitor that categorizes data about an individual send. 72 /// Visitor that categorizes data about an individual send.
81 class _StatsVisitor<T> extends Visitor 73 class _StatsVisitor<T> extends Visitor
82 with SemanticSendResolvedMixin<dynamic, T> 74 with SemanticSendResolvedMixin<dynamic, T>
83 implements SemanticSendVisitor<dynamic, T> { 75 implements SemanticSendVisitor<dynamic, T> {
84
85 // TODO(sigmund): consider passing in several AnalysisResults at once, so we 76 // TODO(sigmund): consider passing in several AnalysisResults at once, so we
86 // can compute the different metrics together. 77 // can compute the different metrics together.
87 /// Information we know about the program from static analysis. 78 /// Information we know about the program from static analysis.
88 final AnalysisResult info; 79 final AnalysisResult info;
89 80
90 /// Results from this function. 81 /// Results from this function.
91 final Measurements measurements; 82 final Measurements measurements;
92 83
93 final DiagnosticReporter reporter; 84 final DiagnosticReporter reporter;
94 final TreeElements elements; 85 final TreeElements elements;
95 86
96 SemanticSendVisitor<dynamic, T> get sendVisitor => this; 87 SemanticSendVisitor<dynamic, T> get sendVisitor => this;
97 88
98 _StatsVisitor(this.reporter, this.elements, this.info, Uri sourceUri) 89 _StatsVisitor(this.reporter, this.elements, this.info, Uri sourceUri)
99 : measurements = new Measurements.reachableFunction(sourceUri); 90 : measurements = new Measurements.reachableFunction(sourceUri);
100 91
101 visitNode(Node node) => throw "unhandled ${node.runtimeType}: $node"; 92 visitNode(Node node) => throw "unhandled ${node.runtimeType}: $node";
102 apply(Node node, T arg) => throw "missing apply ${node.runtimeType}: $node"; 93 apply(Node node, T arg) => throw "missing apply ${node.runtimeType}: $node";
103 internalError(Node node, String arg) => throw "internal error on $node"; 94 internalError(Node node, String arg) => throw "internal error on $node";
104 95
105 visitSend(Send node) { 96 visitSend(Send node) {
106 _checkInvariant(node, 'before'); 97 _checkInvariant(node, 'before');
107 var span = reporter.spanFromSpannable(node); 98 var span = reporter.spanFromSpannable(node);
108 measurements.record(Metric.send, span.begin, span.end); 99 measurements.record(Metric.send, span.begin, span.end);
109 if (node is SendSet) { 100 if (node is SendSet) {
110 if ((node.assignmentOperator != null && 101 if ((node.assignmentOperator != null &&
111 node.assignmentOperator.source != '=') || 102 node.assignmentOperator.source != '=') ||
112 node.isPrefix || 103 node.isPrefix ||
113 node.isPostfix) { 104 node.isPostfix) {
114 assert(!node.isIfNullAssignment); 105 assert(!node.isIfNullAssignment);
115 // We count get and set separately in case one of them is defined by the 106 // We count get and set separately in case one of them is defined by the
116 // other could be a nSM error. 107 // other could be a nSM error.
117 measurements.record(Metric.send, span.begin, span.end); 108 measurements.record(Metric.send, span.begin, span.end);
118 measurements.record(Metric.send, span.begin, span.end); 109 measurements.record(Metric.send, span.begin, span.end);
119 } else if (node.isIfNullAssignment) { 110 } else if (node.isIfNullAssignment) {
120 measurements.record(Metric.send, span.begin, span.end); 111 measurements.record(Metric.send, span.begin, span.end);
121 } 112 }
122 } 113 }
123 super.visitSend(node); 114 super.visitSend(node);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 var span = reporter.spanFromSpannable(node); 208 var span = reporter.spanFromSpannable(node);
218 measurements.record(Metric.polymorphicSend, span.begin, span.end); 209 measurements.record(Metric.polymorphicSend, span.begin, span.end);
219 measurements.record(Metric.multiNsmCallSend, span.begin, span.end); 210 measurements.record(Metric.multiNsmCallSend, span.begin, span.end);
220 } 211 }
221 212
222 handleSuper(Node node) { 213 handleSuper(Node node) {
223 var span = reporter.spanFromSpannable(node); 214 var span = reporter.spanFromSpannable(node);
224 measurements.record(Metric.monomorphicSend, span.begin, span.end); 215 measurements.record(Metric.monomorphicSend, span.begin, span.end);
225 measurements.record(Metric.superSend, span.begin, span.end); 216 measurements.record(Metric.superSend, span.begin, span.end);
226 } 217 }
218
227 handleTypeVariable(Node node) { 219 handleTypeVariable(Node node) {
228 var span = reporter.spanFromSpannable(node); 220 var span = reporter.spanFromSpannable(node);
229 measurements.record(Metric.monomorphicSend, span.begin, span.end); 221 measurements.record(Metric.monomorphicSend, span.begin, span.end);
230 measurements.record(Metric.typeVariableSend, span.begin, span.end); 222 measurements.record(Metric.typeVariableSend, span.begin, span.end);
231 } 223 }
224
232 handleStatic(Node node) { 225 handleStatic(Node node) {
233 var span = reporter.spanFromSpannable(node); 226 var span = reporter.spanFromSpannable(node);
234 measurements.record(Metric.monomorphicSend, span.begin, span.end); 227 measurements.record(Metric.monomorphicSend, span.begin, span.end);
235 measurements.record(Metric.staticSend, span.begin, span.end); 228 measurements.record(Metric.staticSend, span.begin, span.end);
236 } 229 }
237 230
238 handleNoSend(Node node) { 231 handleNoSend(Node node) {
239 measurements.popLast(Metric.send); 232 measurements.popLast(Metric.send);
240 } 233 }
241 234
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 274 }
282 } else { 275 } else {
283 handleDynamic(node); 276 handleDynamic(node);
284 } 277 }
285 return; 278 return;
286 } 279 }
287 280
288 Boolish usesInterceptor = selectorInfo.usesInterceptor; 281 Boolish usesInterceptor = selectorInfo.usesInterceptor;
289 if (hasSelector == Boolish.yes) { 282 if (hasSelector == Boolish.yes) {
290 if (selectorInfo.isAccurate && selectorInfo.possibleTargets == 1) { 283 if (selectorInfo.isAccurate && selectorInfo.possibleTargets == 1) {
291 assert (usesInterceptor != Boolish.maybe); 284 assert(usesInterceptor != Boolish.maybe);
292 if (usesInterceptor == Boolish.yes) { 285 if (usesInterceptor == Boolish.yes) {
293 handleSingleInterceptor(node); 286 handleSingleInterceptor(node);
294 } else { 287 } else {
295 handleSingleInstance(node); 288 handleSingleInstance(node);
296 } 289 }
297 } else { 290 } else {
298 if (usesInterceptor == Boolish.no) { 291 if (usesInterceptor == Boolish.no) {
299 handleVirtual(node); 292 handleVirtual(node);
300 } else if (usesInterceptor == Boolish.yes) { 293 } else if (usesInterceptor == Boolish.yes) {
301 handleMultiInterceptor(node); 294 handleMultiInterceptor(node);
(...skipping 21 matching lines...) Expand all
323 void handleInvoke(Node node) { 316 void handleInvoke(Node node) {
324 handleDynamic(node); 317 handleDynamic(node);
325 } 318 }
326 319
327 void handleEquals(Node node) { 320 void handleEquals(Node node) {
328 handleDynamic(node); 321 handleDynamic(node);
329 } 322 }
330 323
331 // Constructors 324 // Constructors
332 325
333 void visitAbstractClassConstructorInvoke(NewExpression node, 326 void visitAbstractClassConstructorInvoke(
334 ConstructorElement element, InterfaceType type, NodeList arguments, 327 NewExpression node,
335 CallStructure callStructure, T arg) { 328 ConstructorElement element,
329 InterfaceType type,
330 NodeList arguments,
331 CallStructure callStructure,
332 T arg) {
336 handleConstructor(node); 333 handleConstructor(node);
337 } 334 }
338 335
339 void visitBoolFromEnvironmentConstructorInvoke(NewExpression node, 336 void visitBoolFromEnvironmentConstructorInvoke(NewExpression node,
340 BoolFromEnvironmentConstantExpression constant, T arg) { 337 BoolFromEnvironmentConstantExpression constant, T arg) {
341 handleConstructor(node); 338 handleConstructor(node);
342 } 339 }
343 340
344 void visitConstConstructorInvoke( 341 void visitConstConstructorInvoke(
345 NewExpression node, ConstructedConstantExpression constant, T arg) { 342 NewExpression node, ConstructedConstantExpression constant, T arg) {
346 handleConstructor(node); 343 handleConstructor(node);
347 } 344 }
348 345
349 void visitGenerativeConstructorInvoke(NewExpression node, 346 void visitGenerativeConstructorInvoke(
350 ConstructorElement constructor, InterfaceType type, NodeList arguments, 347 NewExpression node,
351 CallStructure callStructure, T arg) { 348 ConstructorElement constructor,
349 InterfaceType type,
350 NodeList arguments,
351 CallStructure callStructure,
352 T arg) {
352 handleConstructor(node); 353 handleConstructor(node);
353 } 354 }
354 355
355 void visitIntFromEnvironmentConstructorInvoke(NewExpression node, 356 void visitIntFromEnvironmentConstructorInvoke(NewExpression node,
356 IntFromEnvironmentConstantExpression constant, T arg) { 357 IntFromEnvironmentConstantExpression constant, T arg) {
357 handleConstructor(node); 358 handleConstructor(node);
358 } 359 }
359 360
360 void visitRedirectingFactoryConstructorInvoke(NewExpression node, 361 void visitRedirectingFactoryConstructorInvoke(
361 ConstructorElement constructor, InterfaceType type, 362 NewExpression node,
362 ConstructorElement effectiveTarget, InterfaceType effectiveTargetType, 363 ConstructorElement constructor,
363 NodeList arguments, CallStructure callStructure, T arg) { 364 InterfaceType type,
365 ConstructorElement effectiveTarget,
366 InterfaceType effectiveTargetType,
367 NodeList arguments,
368 CallStructure callStructure,
369 T arg) {
364 handleConstructor(node); 370 handleConstructor(node);
365 } 371 }
366 372
367 void visitRedirectingGenerativeConstructorInvoke(NewExpression node, 373 void visitRedirectingGenerativeConstructorInvoke(
368 ConstructorElement constructor, InterfaceType type, NodeList arguments, 374 NewExpression node,
369 CallStructure callStructure, T arg) { 375 ConstructorElement constructor,
376 InterfaceType type,
377 NodeList arguments,
378 CallStructure callStructure,
379 T arg) {
370 handleConstructor(node); 380 handleConstructor(node);
371 } 381 }
372 382
373 void visitStringFromEnvironmentConstructorInvoke(NewExpression node, 383 void visitStringFromEnvironmentConstructorInvoke(NewExpression node,
374 StringFromEnvironmentConstantExpression constant, T arg) { 384 StringFromEnvironmentConstantExpression constant, T arg) {
375 handleConstructor(node); 385 handleConstructor(node);
376 } 386 }
377 387
378 // Dynamic sends 388 // Dynamic sends
379 389
380
381 // TODO(sigmund): many many things to add: 390 // TODO(sigmund): many many things to add:
382 // -- support for operators, indexers, etc. 391 // -- support for operators, indexers, etc.
383 // -- logic about nullables 392 // -- logic about nullables
384 // -- int, JSArray 393 // -- int, JSArray
385 // -- all interceptors 394 // -- all interceptors
386 395
387 void visitBinary( 396 void visitBinary(
388 Send node, Node left, BinaryOperator operator, Node right, T arg) { 397 Send node, Node left, BinaryOperator operator, Node right, T arg) {
389 handleOperator(node); 398 handleOperator(node);
390 } 399 }
391 400
392 void visitCompoundIndexSet(SendSet node, Node receiver, Node index, 401 void visitCompoundIndexSet(SendSet node, Node receiver, Node index,
393 AssignmentOperator operator, Node rhs, T arg) { 402 AssignmentOperator operator, Node rhs, T arg) {
394 handleIndex(node); // t1 = receiver[index] 403 handleIndex(node); // t1 = receiver[index]
395 handleOperator(node); // t2 = t1 op rhs 404 handleOperator(node); // t2 = t1 op rhs
396 handleIndex(node); // receiver[index] = t2 405 handleIndex(node); // receiver[index] = t2
397 } 406 }
398 407
399 void visitDynamicPropertyCompound(Send node, Node receiver, 408 void visitDynamicPropertyCompound(Send node, Node receiver, Name name,
400 Name name, AssignmentOperator operator, Node rhs, T arg) { 409 AssignmentOperator operator, Node rhs, T arg) {
401 handleDynamicProperty(node, receiver, new Selector.getter(name)); 410 handleDynamicProperty(node, receiver, new Selector.getter(name));
402 handleOperator(node); 411 handleOperator(node);
403 handleDynamicProperty(node, receiver, new Selector.setter(name)); 412 handleDynamicProperty(node, receiver, new Selector.setter(name));
404 } 413 }
405 414
406 415 void visitDynamicPropertyGet(Send node, Node receiver, Name name, T arg) {
407 void visitDynamicPropertyGet(
408 Send node, Node receiver, Name name, T arg) {
409 handleDynamicProperty(node, receiver, new Selector.getter(name)); 416 handleDynamicProperty(node, receiver, new Selector.getter(name));
410 } 417 }
411 418
412 void visitDynamicPropertyInvoke( 419 void visitDynamicPropertyInvoke(
413 Send node, Node receiver, NodeList arguments, Selector selector, T arg) { 420 Send node, Node receiver, NodeList arguments, Selector selector, T arg) {
414 handleDynamicProperty(node, receiver, selector); 421 handleDynamicProperty(node, receiver, selector);
415 } 422 }
416 423
417 void visitDynamicPropertyPostfix(Send node, Node receiver, 424 void visitDynamicPropertyPostfix(
418 Name name, IncDecOperator operator, T arg) { 425 Send node, Node receiver, Name name, IncDecOperator operator, T arg) {
419 handleDynamicProperty(node, receiver, new Selector.getter(name)); 426 handleDynamicProperty(node, receiver, new Selector.getter(name));
420 handleOperator(node); 427 handleOperator(node);
421 handleDynamicProperty(node, receiver, new Selector.setter(name)); 428 handleDynamicProperty(node, receiver, new Selector.setter(name));
422 } 429 }
423 430
424 void visitDynamicPropertyPrefix(Send node, Node receiver, Name name, 431 void visitDynamicPropertyPrefix(
425 IncDecOperator operator, T arg) { 432 Send node, Node receiver, Name name, IncDecOperator operator, T arg) {
426 handleDynamicProperty(node, receiver, new Selector.getter(name)); 433 handleDynamicProperty(node, receiver, new Selector.getter(name));
427 handleOperator(node); 434 handleOperator(node);
428 handleDynamicProperty(node, receiver, new Selector.setter(name)); 435 handleDynamicProperty(node, receiver, new Selector.setter(name));
429 } 436 }
430 437
431 void visitDynamicPropertySet( 438 void visitDynamicPropertySet(
432 SendSet node, Node receiver, Name name, Node rhs, T arg) { 439 SendSet node, Node receiver, Name name, Node rhs, T arg) {
433 handleDynamicProperty(node, receiver, new Selector.setter(name)); 440 handleDynamicProperty(node, receiver, new Selector.setter(name));
434 } 441 }
435 442
(...skipping 23 matching lines...) Expand all
459 void visitIfNotNullDynamicPropertyGet( 466 void visitIfNotNullDynamicPropertyGet(
460 Send node, Node receiver, Name name, T arg) { 467 Send node, Node receiver, Name name, T arg) {
461 handleDynamicProperty(node, receiver, new Selector.getter(name)); 468 handleDynamicProperty(node, receiver, new Selector.getter(name));
462 } 469 }
463 470
464 void visitIfNotNullDynamicPropertyInvoke( 471 void visitIfNotNullDynamicPropertyInvoke(
465 Send node, Node receiver, NodeList arguments, Selector selector, T arg) { 472 Send node, Node receiver, NodeList arguments, Selector selector, T arg) {
466 handleDynamicProperty(node, receiver, selector); 473 handleDynamicProperty(node, receiver, selector);
467 } 474 }
468 475
469 void visitIfNotNullDynamicPropertyPostfix(Send node, Node receiver, Name name, 476 void visitIfNotNullDynamicPropertyPostfix(
470 IncDecOperator operator, T arg) { 477 Send node, Node receiver, Name name, IncDecOperator operator, T arg) {
471 handleDynamicProperty(node, receiver, new Selector.getter(name)); 478 handleDynamicProperty(node, receiver, new Selector.getter(name));
472 handleOperator(node); 479 handleOperator(node);
473 handleDynamicProperty(node, receiver, new Selector.setter(name)); 480 handleDynamicProperty(node, receiver, new Selector.setter(name));
474 } 481 }
475 482
476 void visitIfNotNullDynamicPropertyPrefix(Send node, Node receiver, Name name, 483 void visitIfNotNullDynamicPropertyPrefix(
477 IncDecOperator operator, T arg) { 484 Send node, Node receiver, Name name, IncDecOperator operator, T arg) {
478 handleDynamicProperty(node, receiver, new Selector.getter(name)); 485 handleDynamicProperty(node, receiver, new Selector.getter(name));
479 handleOperator(node); 486 handleOperator(node);
480 handleDynamicProperty(node, receiver, new Selector.setter(name)); 487 handleDynamicProperty(node, receiver, new Selector.setter(name));
481 } 488 }
482 489
483 void visitIfNotNullDynamicPropertySet( 490 void visitIfNotNullDynamicPropertySet(
484 SendSet node, Node receiver, Name name, Node rhs, T arg) { 491 SendSet node, Node receiver, Name name, Node rhs, T arg) {
485 handleDynamicProperty(node, receiver, new Selector.setter(name)); 492 handleDynamicProperty(node, receiver, new Selector.setter(name));
486 } 493 }
487 494
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 handleSuper(node); 649 handleSuper(node);
643 } 650 }
644 651
645 void visitSuperFieldFieldPrefix(Send node, FieldElement readField, 652 void visitSuperFieldFieldPrefix(Send node, FieldElement readField,
646 FieldElement writtenField, IncDecOperator operator, T arg) { 653 FieldElement writtenField, IncDecOperator operator, T arg) {
647 handleSuper(node); 654 handleSuper(node);
648 handleOperator(node); 655 handleOperator(node);
649 handleSuper(node); 656 handleSuper(node);
650 } 657 }
651 658
652 void visitSuperFieldFieldSetIfNull( 659 void visitSuperFieldFieldSetIfNull(Send node, FieldElement readField,
653 Send node, FieldElement readField, FieldElement writtenField, Node rhs, 660 FieldElement writtenField, Node rhs, T arg) {
654 T arg) {
655 handleSuper(node); 661 handleSuper(node);
656 handleNSMSuper(node, readField.enclosingClass); 662 handleNSMSuper(node, readField.enclosingClass);
657 } 663 }
658 664
659 void visitSuperFieldInvoke(Send node, FieldElement field, NodeList arguments, 665 void visitSuperFieldInvoke(Send node, FieldElement field, NodeList arguments,
660 CallStructure callStructure, T arg) { 666 CallStructure callStructure, T arg) {
661 handleInvoke(node); 667 handleInvoke(node);
662 } 668 }
663 669
664 void visitSuperFieldPostfix( 670 void visitSuperFieldPostfix(
(...skipping 24 matching lines...) Expand all
689 handleSuper(node); 695 handleSuper(node);
690 } 696 }
691 697
692 void visitSuperFieldSetterPrefix(Send node, FieldElement field, 698 void visitSuperFieldSetterPrefix(Send node, FieldElement field,
693 FunctionElement setter, IncDecOperator operator, T arg) { 699 FunctionElement setter, IncDecOperator operator, T arg) {
694 handleSuper(node); 700 handleSuper(node);
695 handleOperator(node); 701 handleOperator(node);
696 handleSuper(node); 702 handleSuper(node);
697 } 703 }
698 704
699 void visitSuperFieldSetterSetIfNull(Send node, FieldElement field, 705 void visitSuperFieldSetterSetIfNull(
700 FunctionElement setter, Node rhs, T arg) { 706 Send node, FieldElement field, FunctionElement setter, Node rhs, T arg) {
701 handleSuper(node); 707 handleSuper(node);
702 handleSuper(node); 708 handleSuper(node);
703 } 709 }
704 710
705 void visitSuperGetterFieldCompound(Send node, FunctionElement getter, 711 void visitSuperGetterFieldCompound(Send node, FunctionElement getter,
706 FieldElement field, AssignmentOperator operator, Node rhs, T arg) { 712 FieldElement field, AssignmentOperator operator, Node rhs, T arg) {
707 handleSuper(node); 713 handleSuper(node);
708 handleOperator(node); 714 handleOperator(node);
709 handleSuper(node); 715 handleSuper(node);
710 } 716 }
711 717
712 void visitSuperGetterFieldPostfix(Send node, FunctionElement getter, 718 void visitSuperGetterFieldPostfix(Send node, FunctionElement getter,
713 FieldElement field, IncDecOperator operator, T arg) { 719 FieldElement field, IncDecOperator operator, T arg) {
714 handleSuper(node); 720 handleSuper(node);
715 handleOperator(node); 721 handleOperator(node);
716 handleSuper(node); 722 handleSuper(node);
717 } 723 }
718 724
719 void visitSuperGetterFieldPrefix(Send node, FunctionElement getter, 725 void visitSuperGetterFieldPrefix(Send node, FunctionElement getter,
720 FieldElement field, IncDecOperator operator, T arg) { 726 FieldElement field, IncDecOperator operator, T arg) {
721 handleSuper(node); 727 handleSuper(node);
722 handleOperator(node); 728 handleOperator(node);
723 handleSuper(node); 729 handleSuper(node);
724 } 730 }
725 731
726 void visitSuperGetterFieldSetIfNull(Send node, FunctionElement getter, 732 void visitSuperGetterFieldSetIfNull(
727 FieldElement field, Node rhs, T arg) { 733 Send node, FunctionElement getter, FieldElement field, Node rhs, T arg) {
728 handleSuper(node); 734 handleSuper(node);
729 handleSuper(node); 735 handleSuper(node);
730 } 736 }
731 737
732 void visitSuperGetterInvoke(Send node, FunctionElement getter, 738 void visitSuperGetterInvoke(Send node, FunctionElement getter,
733 NodeList arguments, CallStructure callStructure, T arg) { 739 NodeList arguments, CallStructure callStructure, T arg) {
734 handleInvoke(node); 740 handleInvoke(node);
735 } 741 }
736 742
737 void visitSuperGetterSetterCompound(Send node, FunctionElement getter, 743 void visitSuperGetterSetterCompound(Send node, FunctionElement getter,
(...skipping 16 matching lines...) Expand all
754 handleOperator(node); 760 handleOperator(node);
755 handleSuper(node); 761 handleSuper(node);
756 } 762 }
757 763
758 void visitSuperGetterSetterSetIfNull(Send node, FunctionElement getter, 764 void visitSuperGetterSetterSetIfNull(Send node, FunctionElement getter,
759 FunctionElement setter, Node rhs, T arg) { 765 FunctionElement setter, Node rhs, T arg) {
760 handleSuper(node); 766 handleSuper(node);
761 handleSuper(node); 767 handleSuper(node);
762 } 768 }
763 769
764 void visitSuperIndexPostfix(Send node, MethodElement indexFunction, 770 void visitSuperIndexPostfix(
765 MethodElement indexSetFunction, Node index, IncDecOperator operator, 771 Send node,
772 MethodElement indexFunction,
773 MethodElement indexSetFunction,
774 Node index,
775 IncDecOperator operator,
766 T arg) { 776 T arg) {
767 handleSuper(node); 777 handleSuper(node);
768 handleOperator(node); 778 handleOperator(node);
769 handleSuper(node); 779 handleSuper(node);
770 } 780 }
771 781
772 void visitSuperIndexPrefix(Send node, MethodElement indexFunction, 782 void visitSuperIndexPrefix(
773 MethodElement indexSetFunction, Node index, IncDecOperator operator, 783 Send node,
784 MethodElement indexFunction,
785 MethodElement indexSetFunction,
786 Node index,
787 IncDecOperator operator,
774 T arg) { 788 T arg) {
775 handleSuper(node); 789 handleSuper(node);
776 handleOperator(node); 790 handleOperator(node);
777 handleSuper(node); 791 handleSuper(node);
778 } 792 }
779 793
780 void visitSuperMethodSetterCompound(Send node, FunctionElement method, 794 void visitSuperMethodSetterCompound(Send node, FunctionElement method,
781 FunctionElement setter, AssignmentOperator operator, Node rhs, T arg) { 795 FunctionElement setter, AssignmentOperator operator, Node rhs, T arg) {
782 handleSuper(node); 796 handleSuper(node);
783 handleNSMSuper(node, method.enclosingClass); 797 handleNSMSuper(node, method.enclosingClass);
(...skipping 13 matching lines...) Expand all
797 handleNSMSuper(node, method.enclosingClass); 811 handleNSMSuper(node, method.enclosingClass);
798 handleSuper(node); 812 handleSuper(node);
799 } 813 }
800 814
801 void visitSuperMethodSetterSetIfNull(Send node, FunctionElement method, 815 void visitSuperMethodSetterSetIfNull(Send node, FunctionElement method,
802 FunctionElement setter, Node rhs, T arg) { 816 FunctionElement setter, Node rhs, T arg) {
803 handleSuper(node); 817 handleSuper(node);
804 handleSuper(node); 818 handleSuper(node);
805 } 819 }
806 820
807 void visitThisPropertyCompound(Send node, Name name, 821 void visitThisPropertyCompound(
808 AssignmentOperator operator, Node rhs, T arg) { 822 Send node, Name name, AssignmentOperator operator, Node rhs, T arg) {
809 handleThisProperty(node, new Selector.getter(name)); 823 handleThisProperty(node, new Selector.getter(name));
810 handleOperator(node); 824 handleOperator(node);
811 handleThisProperty(node, new Selector.setter(name)); 825 handleThisProperty(node, new Selector.setter(name));
812 } 826 }
813 827
814 void visitThisPropertyInvoke( 828 void visitThisPropertyInvoke(
815 Send node, NodeList arguments, Selector selector, T arg) { 829 Send node, NodeList arguments, Selector selector, T arg) {
816 handleThisProperty(node, selector); 830 handleThisProperty(node, selector);
817 } 831 }
818 832
819 void visitThisPropertyPostfix(Send node, Name name, IncDecOperator operator, 833 void visitThisPropertyPostfix(
820 T arg) { 834 Send node, Name name, IncDecOperator operator, T arg) {
821 handleThisProperty(node, new Selector.getter(name)); 835 handleThisProperty(node, new Selector.getter(name));
822 handleOperator(node); 836 handleOperator(node);
823 handleThisProperty(node, new Selector.setter(name)); 837 handleThisProperty(node, new Selector.setter(name));
824 } 838 }
825 839
826 void visitThisPropertyPrefix(Send node, Name name, IncDecOperator operator, 840 void visitThisPropertyPrefix(
827 T arg) { 841 Send node, Name name, IncDecOperator operator, T arg) {
828 handleThisProperty(node, new Selector.getter(name)); 842 handleThisProperty(node, new Selector.getter(name));
829 handleOperator(node); 843 handleOperator(node);
830 handleThisProperty(node, new Selector.setter(name)); 844 handleThisProperty(node, new Selector.setter(name));
831 } 845 }
832 846
833 void visitTopLevelFieldCompound(Send node, FieldElement field, 847 void visitTopLevelFieldCompound(Send node, FieldElement field,
834 AssignmentOperator operator, Node rhs, T arg) { 848 AssignmentOperator operator, Node rhs, T arg) {
835 handleStatic(node); 849 handleStatic(node);
836 handleOperator(node); 850 handleOperator(node);
837 handleStatic(node); 851 handleStatic(node);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 handleSuper(node); 1004 handleSuper(node);
991 } 1005 }
992 1006
993 void visitSuperUnary( 1007 void visitSuperUnary(
994 Send node, UnaryOperator operator, FunctionElement function, T arg) { 1008 Send node, UnaryOperator operator, FunctionElement function, T arg) {
995 handleSuper(node); 1009 handleSuper(node);
996 } 1010 }
997 1011
998 // Statically known "no such method" sends 1012 // Statically known "no such method" sends
999 1013
1000 void visitConstructorIncompatibleInvoke(NewExpression node, 1014 void visitConstructorIncompatibleInvoke(
1001 ConstructorElement constructor, InterfaceType type, NodeList arguments, 1015 NewExpression node,
1002 CallStructure callStructure, T arg) { 1016 ConstructorElement constructor,
1017 InterfaceType type,
1018 NodeList arguments,
1019 CallStructure callStructure,
1020 T arg) {
1003 handleNSMError(node); 1021 handleNSMError(node);
1004 } 1022 }
1005 1023
1006 void visitFinalLocalVariableCompound(Send node, LocalVariableElement variable, 1024 void visitFinalLocalVariableCompound(Send node, LocalVariableElement variable,
1007 AssignmentOperator operator, Node rhs, T arg) { 1025 AssignmentOperator operator, Node rhs, T arg) {
1008 handleLocal(node); 1026 handleLocal(node);
1009 handleOperator(node); 1027 handleOperator(node);
1010 handleNSMError(node); 1028 handleNSMError(node);
1011 } 1029 }
1012 1030
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 SendSet node, FieldElement field, Node rhs, T arg) { 1110 SendSet node, FieldElement field, Node rhs, T arg) {
1093 handleNSMError(node); 1111 handleNSMError(node);
1094 } 1112 }
1095 1113
1096 void visitFinalStaticFieldSetIfNull( 1114 void visitFinalStaticFieldSetIfNull(
1097 SendSet node, FieldElement field, Node rhs, T arg) { 1115 SendSet node, FieldElement field, Node rhs, T arg) {
1098 handleStatic(node); 1116 handleStatic(node);
1099 handleNSMError(node); 1117 handleNSMError(node);
1100 } 1118 }
1101 1119
1102 void visitFinalSuperFieldSetIfNull(Send node, FieldElement field, 1120 void visitFinalSuperFieldSetIfNull(
1103 Node rhs, T arg) { 1121 Send node, FieldElement field, Node rhs, T arg) {
1104 handleSuper(node); 1122 handleSuper(node);
1105 handleNSMSuper(node, field.enclosingClass); 1123 handleNSMSuper(node, field.enclosingClass);
1106 } 1124 }
1107 1125
1108 void visitFinalSuperFieldCompound(Send node, FieldElement field, 1126 void visitFinalSuperFieldCompound(Send node, FieldElement field,
1109 AssignmentOperator operator, Node rhs, T arg) { 1127 AssignmentOperator operator, Node rhs, T arg) {
1110 handleSuper(node); 1128 handleSuper(node);
1111 handleOperator(node); 1129 handleOperator(node);
1112 handleNSMSuper(node, field.enclosingClass); 1130 handleNSMSuper(node, field.enclosingClass);
1113 } 1131 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 handleStatic(node); 1186 handleStatic(node);
1169 handleStatic(node); 1187 handleStatic(node);
1170 } 1188 }
1171 1189
1172 void visitTopLevelMethodSetterSetIfNull(Send node, FunctionElement method, 1190 void visitTopLevelMethodSetterSetIfNull(Send node, FunctionElement method,
1173 FunctionElement setter, Node rhs, T arg) { 1191 FunctionElement setter, Node rhs, T arg) {
1174 handleStatic(node); 1192 handleStatic(node);
1175 handleStatic(node); 1193 handleStatic(node);
1176 } 1194 }
1177 1195
1178 void visitTopLevelMethodSetIfNull(Send node, FunctionElement method, 1196 void visitTopLevelMethodSetIfNull(
1179 Node rhs, T arg) { 1197 Send node, FunctionElement method, Node rhs, T arg) {
1180 handleStatic(node); 1198 handleStatic(node);
1181 handleNSMError(node); 1199 handleNSMError(node);
1182 } 1200 }
1183 1201
1184 void visitLocalFunctionIncompatibleInvoke(Send node, 1202 void visitLocalFunctionIncompatibleInvoke(
1185 LocalFunctionElement function, NodeList arguments, 1203 Send node,
1186 CallStructure callStructure, T arg) { 1204 LocalFunctionElement function,
1205 NodeList arguments,
1206 CallStructure callStructure,
1207 T arg) {
1187 handleNSMError(node); 1208 handleNSMError(node);
1188 } 1209 }
1189 1210
1190 void visitLocalFunctionCompound(Send node, LocalFunctionElement function, 1211 void visitLocalFunctionCompound(Send node, LocalFunctionElement function,
1191 AssignmentOperator operator, Node rhs, T arg) { 1212 AssignmentOperator operator, Node rhs, T arg) {
1192 handleLocal(node); 1213 handleLocal(node);
1193 handleNSMError(node); 1214 handleNSMError(node);
1194 handleNoSend(node); 1215 handleNoSend(node);
1195 } 1216 }
1196 1217
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 1341
1321 void visitSuperSetterGet(Send node, FunctionElement setter, T arg) { 1342 void visitSuperSetterGet(Send node, FunctionElement setter, T arg) {
1322 handleNSMSuper(node, setter.enclosingClass); 1343 handleNSMSuper(node, setter.enclosingClass);
1323 } 1344 }
1324 1345
1325 void visitSuperSetterInvoke(Send node, FunctionElement setter, 1346 void visitSuperSetterInvoke(Send node, FunctionElement setter,
1326 NodeList arguments, CallStructure callStructure, T arg) { 1347 NodeList arguments, CallStructure callStructure, T arg) {
1327 handleNSMSuper(node, setter.enclosingClass); 1348 handleNSMSuper(node, setter.enclosingClass);
1328 } 1349 }
1329 1350
1330 void visitTopLevelFunctionIncompatibleInvoke(Send node, 1351 void visitTopLevelFunctionIncompatibleInvoke(
1331 MethodElement function, NodeList arguments, CallStructure callStructure, 1352 Send node,
1353 MethodElement function,
1354 NodeList arguments,
1355 CallStructure callStructure,
1332 T arg) { 1356 T arg) {
1333 handleNSMError(node); 1357 handleNSMError(node);
1334 } 1358 }
1335 1359
1336 void visitTopLevelFunctionSet( 1360 void visitTopLevelFunctionSet(
1337 Send node, MethodElement function, Node rhs, T arg) { 1361 Send node, MethodElement function, Node rhs, T arg) {
1338 handleNSMError(node); 1362 handleNSMError(node);
1339 } 1363 }
1340 1364
1341 void visitTopLevelGetterSet( 1365 void visitTopLevelGetterSet(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 1411
1388 void visitTopLevelSetterGet(Send node, FunctionElement setter, T arg) { 1412 void visitTopLevelSetterGet(Send node, FunctionElement setter, T arg) {
1389 handleNSMError(node); 1413 handleNSMError(node);
1390 } 1414 }
1391 1415
1392 void visitTopLevelSetterInvoke(Send node, FunctionElement setter, 1416 void visitTopLevelSetterInvoke(Send node, FunctionElement setter,
1393 NodeList arguments, CallStructure callStructure, T arg) { 1417 NodeList arguments, CallStructure callStructure, T arg) {
1394 handleNSMError(node); 1418 handleNSMError(node);
1395 } 1419 }
1396 1420
1397 void visitTypeVariableTypeLiteralCompound(Send node, 1421 void visitTypeVariableTypeLiteralCompound(
1398 TypeVariableElement element, AssignmentOperator operator, Node rhs, 1422 Send node,
1423 TypeVariableElement element,
1424 AssignmentOperator operator,
1425 Node rhs,
1399 T arg) { 1426 T arg) {
1400 handleTypeVariable(node); 1427 handleTypeVariable(node);
1401 handleNSMError(node); // operator on a method closure yields nSM 1428 handleNSMError(node); // operator on a method closure yields nSM
1402 handleNoSend(node); // setter is not invoked, don't count it. 1429 handleNoSend(node); // setter is not invoked, don't count it.
1403 } 1430 }
1404 1431
1405 void visitTypeVariableTypeLiteralGet( 1432 void visitTypeVariableTypeLiteralGet(
1406 Send node, TypeVariableElement element, T arg) { 1433 Send node, TypeVariableElement element, T arg) {
1407 handleTypeVariable(node); 1434 handleTypeVariable(node);
1408 } 1435 }
1409 1436
1410 void visitTypeVariableTypeLiteralInvoke(Send node, 1437 void visitTypeVariableTypeLiteralInvoke(
1411 TypeVariableElement element, NodeList arguments, 1438 Send node,
1412 CallStructure callStructure, T arg) { 1439 TypeVariableElement element,
1440 NodeList arguments,
1441 CallStructure callStructure,
1442 T arg) {
1413 handleNSMError(node); 1443 handleNSMError(node);
1414 } 1444 }
1415 1445
1416 void visitTypeVariableTypeLiteralPostfix( 1446 void visitTypeVariableTypeLiteralPostfix(
1417 Send node, TypeVariableElement element, IncDecOperator operator, T arg) { 1447 Send node, TypeVariableElement element, IncDecOperator operator, T arg) {
1418 handleTypeVariable(node); 1448 handleTypeVariable(node);
1419 handleNSMError(node); 1449 handleNSMError(node);
1420 handleNoSend(node); 1450 handleNoSend(node);
1421 } 1451 }
1422 1452
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 SendSet node, ConstantExpression constant, Node rhs, T arg) { 1503 SendSet node, ConstantExpression constant, Node rhs, T arg) {
1474 handleNSMError(node); 1504 handleNSMError(node);
1475 } 1505 }
1476 1506
1477 void visitTypedefTypeLiteralSetIfNull( 1507 void visitTypedefTypeLiteralSetIfNull(
1478 SendSet node, ConstantExpression constant, Node rhs, T arg) { 1508 SendSet node, ConstantExpression constant, Node rhs, T arg) {
1479 handleStatic(node); 1509 handleStatic(node);
1480 handleNSMError(node); 1510 handleNSMError(node);
1481 } 1511 }
1482 1512
1483 void visitUnresolvedClassConstructorInvoke(NewExpression node, 1513 void visitUnresolvedClassConstructorInvoke(
1484 Element element, DartType type, NodeList arguments, Selector selector, 1514 NewExpression node,
1515 Element element,
1516 DartType type,
1517 NodeList arguments,
1518 Selector selector,
1485 T arg) { 1519 T arg) {
1486 handleNSMError(node); 1520 handleNSMError(node);
1487 } 1521 }
1488 1522
1489 void visitUnresolvedCompound(Send node, Element element, 1523 void visitUnresolvedCompound(Send node, Element element,
1490 AssignmentOperator operator, Node rhs, T arg) { 1524 AssignmentOperator operator, Node rhs, T arg) {
1491 handleNSMError(node); 1525 handleNSMError(node);
1492 handleNoSend(node); 1526 handleNoSend(node);
1493 handleNoSend(node); 1527 handleNoSend(node);
1494 } 1528 }
(...skipping 19 matching lines...) Expand all
1514 handleNoSend(node); 1548 handleNoSend(node);
1515 } 1549 }
1516 1550
1517 void visitUnresolvedPrefix( 1551 void visitUnresolvedPrefix(
1518 Send node, Element element, IncDecOperator operator, T arg) { 1552 Send node, Element element, IncDecOperator operator, T arg) {
1519 handleNSMError(node); 1553 handleNSMError(node);
1520 handleNoSend(node); 1554 handleNoSend(node);
1521 handleNoSend(node); 1555 handleNoSend(node);
1522 } 1556 }
1523 1557
1524 void visitUnresolvedRedirectingFactoryConstructorInvoke(NewExpression node, 1558 void visitUnresolvedRedirectingFactoryConstructorInvoke(
1525 ConstructorElement constructor, InterfaceType type, NodeList arguments, 1559 NewExpression node,
1526 CallStructure callStructure, T arg) { 1560 ConstructorElement constructor,
1561 InterfaceType type,
1562 NodeList arguments,
1563 CallStructure callStructure,
1564 T arg) {
1527 handleNSMError(node); 1565 handleNSMError(node);
1528 } 1566 }
1529 1567
1530 void visitUnresolvedSet(Send node, Element element, Node rhs, T arg) { 1568 void visitUnresolvedSet(Send node, Element element, Node rhs, T arg) {
1531 handleNSMError(node); 1569 handleNSMError(node);
1532 } 1570 }
1533 1571
1534 void visitUnresolvedSetIfNull(Send node, Element element, Node rhs, T arg) { 1572 void visitUnresolvedSetIfNull(Send node, Element element, Node rhs, T arg) {
1535 handleNSMError(node); 1573 handleNSMError(node);
1536 handleNoSend(node); 1574 handleNoSend(node);
(...skipping 13 matching lines...) Expand all
1550 handleNoSend(node); 1588 handleNoSend(node);
1551 } 1589 }
1552 1590
1553 void visitUnresolvedStaticGetterPrefix(Send node, Element element, 1591 void visitUnresolvedStaticGetterPrefix(Send node, Element element,
1554 MethodElement setter, IncDecOperator operator, T arg) { 1592 MethodElement setter, IncDecOperator operator, T arg) {
1555 handleNSMError(node); 1593 handleNSMError(node);
1556 handleNoSend(node); 1594 handleNoSend(node);
1557 handleNoSend(node); 1595 handleNoSend(node);
1558 } 1596 }
1559 1597
1560 void visitUnresolvedStaticGetterSetIfNull(Send node, Element element, 1598 void visitUnresolvedStaticGetterSetIfNull(
1561 MethodElement setter, Node rhs, T arg) { 1599 Send node, Element element, MethodElement setter, Node rhs, T arg) {
1562 handleNSMError(node); 1600 handleNSMError(node);
1563 handleNoSend(node); 1601 handleNoSend(node);
1564 } 1602 }
1565 1603
1566 void visitUnresolvedStaticSetterCompound(Send node, MethodElement getter, 1604 void visitUnresolvedStaticSetterCompound(Send node, MethodElement getter,
1567 Element element, AssignmentOperator operator, Node rhs, T arg) { 1605 Element element, AssignmentOperator operator, Node rhs, T arg) {
1568 handleNSMError(node); 1606 handleNSMError(node);
1569 handleNoSend(node); 1607 handleNoSend(node);
1570 handleNoSend(node); 1608 handleNoSend(node);
1571 } 1609 }
1572 1610
1573 void visitUnresolvedStaticSetterPostfix(Send node, MethodElement getter, 1611 void visitUnresolvedStaticSetterPostfix(Send node, MethodElement getter,
1574 Element element, IncDecOperator operator, T arg) { 1612 Element element, IncDecOperator operator, T arg) {
1575 handleNSMError(node); 1613 handleNSMError(node);
1576 handleNoSend(node); 1614 handleNoSend(node);
1577 handleNoSend(node); 1615 handleNoSend(node);
1578 } 1616 }
1579 1617
1580 void visitUnresolvedStaticSetterPrefix(Send node, MethodElement getter, 1618 void visitUnresolvedStaticSetterPrefix(Send node, MethodElement getter,
1581 Element element, IncDecOperator operator, T arg) { 1619 Element element, IncDecOperator operator, T arg) {
1582 handleNSMError(node); 1620 handleNSMError(node);
1583 handleNoSend(node); 1621 handleNoSend(node);
1584 handleNoSend(node); 1622 handleNoSend(node);
1585 } 1623 }
1586 1624
1587 void visitUnresolvedStaticSetterSetIfNull(Send node, MethodElement getter, 1625 void visitUnresolvedStaticSetterSetIfNull(
1588 Element element, Node rhs, T arg) { 1626 Send node, MethodElement getter, Element element, Node rhs, T arg) {
1589 handleNSMError(node); 1627 handleNSMError(node);
1590 handleNoSend(node); 1628 handleNoSend(node);
1591 } 1629 }
1592 1630
1593 void visitUnresolvedSuperBinary(Send node, Element element, 1631 void visitUnresolvedSuperBinary(Send node, Element element,
1594 BinaryOperator operator, Node argument, T arg) { 1632 BinaryOperator operator, Node argument, T arg) {
1595 handleNSMSuper(node, element.enclosingClass); 1633 handleNSMSuper(node, element.enclosingClass);
1596 } 1634 }
1597 1635
1598 void visitUnresolvedSuperCompound(Send node, Element element, 1636 void visitUnresolvedSuperCompound(Send node, Element element,
(...skipping 26 matching lines...) Expand all
1625 handleNoSend(node); 1663 handleNoSend(node);
1626 } 1664 }
1627 1665
1628 void visitUnresolvedSuperGetterCompound(Send node, Element element, 1666 void visitUnresolvedSuperGetterCompound(Send node, Element element,
1629 MethodElement setter, AssignmentOperator operator, Node rhs, T arg) { 1667 MethodElement setter, AssignmentOperator operator, Node rhs, T arg) {
1630 handleNSMSuper(node, element.enclosingClass); 1668 handleNSMSuper(node, element.enclosingClass);
1631 handleOperator(node); 1669 handleOperator(node);
1632 handleSuper(node); 1670 handleSuper(node);
1633 } 1671 }
1634 1672
1635 void visitUnresolvedSuperGetterCompoundIndexSet(Send node, Element element, 1673 void visitUnresolvedSuperGetterCompoundIndexSet(
1636 MethodElement setter, Node index, AssignmentOperator operator, Node rhs, 1674 Send node,
1675 Element element,
1676 MethodElement setter,
1677 Node index,
1678 AssignmentOperator operator,
1679 Node rhs,
1637 T arg) { 1680 T arg) {
1638 handleNSMSuper(node, element.enclosingClass); 1681 handleNSMSuper(node, element.enclosingClass);
1639 handleOperator(node); 1682 handleOperator(node);
1640 handleSuper(node); 1683 handleSuper(node);
1641 } 1684 }
1642 1685
1643 void visitUnresolvedSuperGetterIndexPostfix(Send node, Element element, 1686 void visitUnresolvedSuperGetterIndexPostfix(Send node, Element element,
1644 MethodElement setter, Node index, IncDecOperator operator, T arg) { 1687 MethodElement setter, Node index, IncDecOperator operator, T arg) {
1645 handleNSMSuper(node, element.enclosingClass); 1688 handleNSMSuper(node, element.enclosingClass);
1646 handleOperator(node); 1689 handleOperator(node);
(...skipping 14 matching lines...) Expand all
1661 handleSuper(node); 1704 handleSuper(node);
1662 } 1705 }
1663 1706
1664 void visitUnresolvedSuperGetterPrefix(Send node, Element element, 1707 void visitUnresolvedSuperGetterPrefix(Send node, Element element,
1665 MethodElement setter, IncDecOperator operator, T arg) { 1708 MethodElement setter, IncDecOperator operator, T arg) {
1666 handleNSMSuper(node, element.enclosingClass); 1709 handleNSMSuper(node, element.enclosingClass);
1667 handleOperator(node); 1710 handleOperator(node);
1668 handleSuper(node); 1711 handleSuper(node);
1669 } 1712 }
1670 1713
1671 void visitUnresolvedSuperGetterSetIfNull(Send node, Element element, 1714 void visitUnresolvedSuperGetterSetIfNull(
1672 MethodElement setter, Node rhs, T arg) { 1715 Send node, Element element, MethodElement setter, Node rhs, T arg) {
1673 handleNSMSuper(node, element.enclosingClass); 1716 handleNSMSuper(node, element.enclosingClass);
1674 handleSuper(node); 1717 handleSuper(node);
1675 } 1718 }
1676 1719
1677 void visitUnresolvedSuperIndex( 1720 void visitUnresolvedSuperIndex(
1678 Send node, Element element, Node index, T arg) { 1721 Send node, Element element, Node index, T arg) {
1679 handleNSMSuper(node, element.enclosingClass); 1722 handleNSMSuper(node, element.enclosingClass);
1680 } 1723 }
1681 1724
1682 void visitUnresolvedSuperIndexPostfix( 1725 void visitUnresolvedSuperIndexPostfix(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 handleNSMSuper(node, element.enclosingClass); 1760 handleNSMSuper(node, element.enclosingClass);
1718 } 1761 }
1719 1762
1720 void visitUnresolvedSuperSetterCompound(Send node, MethodElement getter, 1763 void visitUnresolvedSuperSetterCompound(Send node, MethodElement getter,
1721 Element element, AssignmentOperator operator, Node rhs, T arg) { 1764 Element element, AssignmentOperator operator, Node rhs, T arg) {
1722 handleSuper(node); 1765 handleSuper(node);
1723 handleOperator(node); 1766 handleOperator(node);
1724 handleNSMSuper(node, element.enclosingClass); 1767 handleNSMSuper(node, element.enclosingClass);
1725 } 1768 }
1726 1769
1727 void visitUnresolvedSuperSetterCompoundIndexSet(Send node, 1770 void visitUnresolvedSuperSetterCompoundIndexSet(
1728 MethodElement getter, Element element, Node index, 1771 Send node,
1729 AssignmentOperator operator, Node rhs, T arg) { 1772 MethodElement getter,
1773 Element element,
1774 Node index,
1775 AssignmentOperator operator,
1776 Node rhs,
1777 T arg) {
1730 handleSuper(node); 1778 handleSuper(node);
1731 handleOperator(node); 1779 handleOperator(node);
1732 handleNSMSuper(node, element.enclosingClass); 1780 handleNSMSuper(node, element.enclosingClass);
1733 } 1781 }
1734 1782
1735 void visitUnresolvedSuperSetterIndexPostfix(Send node, 1783 void visitUnresolvedSuperSetterIndexPostfix(
1736 MethodElement indexFunction, Element element, Node index, 1784 Send node,
1737 IncDecOperator operator, T arg) { 1785 MethodElement indexFunction,
1786 Element element,
1787 Node index,
1788 IncDecOperator operator,
1789 T arg) {
1738 handleSuper(node); 1790 handleSuper(node);
1739 handleOperator(node); 1791 handleOperator(node);
1740 handleNSMSuper(node, element.enclosingClass); 1792 handleNSMSuper(node, element.enclosingClass);
1741 } 1793 }
1742 1794
1743 void visitUnresolvedSuperSetterIndexPrefix(Send node, 1795 void visitUnresolvedSuperSetterIndexPrefix(
1744 MethodElement indexFunction, Element element, Node index, 1796 Send node,
1745 IncDecOperator operator, T arg) { 1797 MethodElement indexFunction,
1798 Element element,
1799 Node index,
1800 IncDecOperator operator,
1801 T arg) {
1746 handleSuper(node); 1802 handleSuper(node);
1747 handleOperator(node); 1803 handleOperator(node);
1748 handleNSMSuper(node, element.enclosingClass); 1804 handleNSMSuper(node, element.enclosingClass);
1749 } 1805 }
1750 1806
1751 void visitUnresolvedSuperSetterPostfix(Send node, MethodElement getter, 1807 void visitUnresolvedSuperSetterPostfix(Send node, MethodElement getter,
1752 Element element, IncDecOperator operator, T arg) { 1808 Element element, IncDecOperator operator, T arg) {
1753 handleSuper(node); 1809 handleSuper(node);
1754 handleOperator(node); 1810 handleOperator(node);
1755 handleNSMSuper(node, element.enclosingClass); 1811 handleNSMSuper(node, element.enclosingClass);
1756 } 1812 }
1757 1813
1758 void visitUnresolvedSuperSetterPrefix(Send node, MethodElement getter, 1814 void visitUnresolvedSuperSetterPrefix(Send node, MethodElement getter,
1759 Element element, IncDecOperator operator, T arg) { 1815 Element element, IncDecOperator operator, T arg) {
1760 handleSuper(node); 1816 handleSuper(node);
1761 handleOperator(node); 1817 handleOperator(node);
1762 handleNSMSuper(node, element.enclosingClass); 1818 handleNSMSuper(node, element.enclosingClass);
1763 } 1819 }
1764 1820
1765 void visitUnresolvedSuperSetterSetIfNull(Send node, MethodElement getter, 1821 void visitUnresolvedSuperSetterSetIfNull(
1766 Element element, Node rhs, T arg) { 1822 Send node, MethodElement getter, Element element, Node rhs, T arg) {
1767 handleSuper(node); 1823 handleSuper(node);
1768 handleNSMSuper(node, element.enclosingClass); 1824 handleNSMSuper(node, element.enclosingClass);
1769 } 1825 }
1770 1826
1771 void visitUnresolvedSuperUnary( 1827 void visitUnresolvedSuperUnary(
1772 Send node, UnaryOperator operator, Element element, T arg) { 1828 Send node, UnaryOperator operator, Element element, T arg) {
1773 handleNSMSuper(node, element.enclosingClass); 1829 handleNSMSuper(node, element.enclosingClass);
1774 } 1830 }
1775 1831
1776 void visitUnresolvedTopLevelGetterCompound(Send node, Element element, 1832 void visitUnresolvedTopLevelGetterCompound(Send node, Element element,
(...skipping 10 matching lines...) Expand all
1787 handleNoSend(node); 1843 handleNoSend(node);
1788 } 1844 }
1789 1845
1790 void visitUnresolvedTopLevelGetterPrefix(Send node, Element element, 1846 void visitUnresolvedTopLevelGetterPrefix(Send node, Element element,
1791 MethodElement setter, IncDecOperator operator, T arg) { 1847 MethodElement setter, IncDecOperator operator, T arg) {
1792 handleNSMError(node); 1848 handleNSMError(node);
1793 handleNoSend(node); 1849 handleNoSend(node);
1794 handleNoSend(node); 1850 handleNoSend(node);
1795 } 1851 }
1796 1852
1797 void visitUnresolvedTopLevelGetterSetIfNull(Send node, Element element, 1853 void visitUnresolvedTopLevelGetterSetIfNull(
1798 MethodElement setter, Node rhs, T arg) { 1854 Send node, Element element, MethodElement setter, Node rhs, T arg) {
1799 handleNSMError(node); 1855 handleNSMError(node);
1800 handleNoSend(node); 1856 handleNoSend(node);
1801 } 1857 }
1802 1858
1803 void visitUnresolvedTopLevelSetterCompound(Send node, MethodElement getter, 1859 void visitUnresolvedTopLevelSetterCompound(Send node, MethodElement getter,
1804 Element element, AssignmentOperator operator, Node rhs, T arg) { 1860 Element element, AssignmentOperator operator, Node rhs, T arg) {
1805 handleNSMError(node); 1861 handleNSMError(node);
1806 handleNoSend(node); 1862 handleNoSend(node);
1807 handleNoSend(node); 1863 handleNoSend(node);
1808 } 1864 }
1809 1865
1810 void visitUnresolvedTopLevelSetterPostfix(Send node, MethodElement getter, 1866 void visitUnresolvedTopLevelSetterPostfix(Send node, MethodElement getter,
1811 Element element, IncDecOperator operator, T arg) { 1867 Element element, IncDecOperator operator, T arg) {
1812 handleNSMError(node); 1868 handleNSMError(node);
1813 handleNoSend(node); 1869 handleNoSend(node);
1814 handleNoSend(node); 1870 handleNoSend(node);
1815 } 1871 }
1816 1872
1817 void visitUnresolvedTopLevelSetterPrefix(Send node, MethodElement getter, 1873 void visitUnresolvedTopLevelSetterPrefix(Send node, MethodElement getter,
1818 Element element, IncDecOperator operator, T arg) { 1874 Element element, IncDecOperator operator, T arg) {
1819 handleNSMError(node); 1875 handleNSMError(node);
1820 handleNoSend(node); 1876 handleNoSend(node);
1821 handleNoSend(node); 1877 handleNoSend(node);
1822 } 1878 }
1823 1879
1824 void visitUnresolvedTopLevelSetterSetIfNull(Send node, MethodElement getter, 1880 void visitUnresolvedTopLevelSetterSetIfNull(
1825 Element element, Node rhs, T arg) { 1881 Send node, MethodElement getter, Element element, Node rhs, T arg) {
1826 handleNSMError(node); 1882 handleNSMError(node);
1827 handleNoSend(node); 1883 handleNoSend(node);
1828 } 1884 }
1829 1885
1830 // Static 1886 // Static
1831 1887
1832 void visitConstantGet(Send node, ConstantExpression constant, T arg) { 1888 void visitConstantGet(Send node, ConstantExpression constant, T arg) {
1833 handleStatic(node); 1889 handleStatic(node);
1834 } 1890 }
1835 1891
1836 void visitConstantInvoke(Send node, ConstantExpression constant, 1892 void visitConstantInvoke(Send node, ConstantExpression constant,
1837 NodeList arguments, CallStructure callStreucture, T arg) { 1893 NodeList arguments, CallStructure callStreucture, T arg) {
1838 handleStatic(node); 1894 handleStatic(node);
1839 } 1895 }
1840 1896
1841 void visitFactoryConstructorInvoke(NewExpression node, 1897 void visitFactoryConstructorInvoke(
1842 ConstructorElement constructor, InterfaceType type, NodeList arguments, 1898 NewExpression node,
1843 CallStructure callStructure, T arg) { 1899 ConstructorElement constructor,
1900 InterfaceType type,
1901 NodeList arguments,
1902 CallStructure callStructure,
1903 T arg) {
1844 handleStatic(node); 1904 handleStatic(node);
1845 } 1905 }
1846 1906
1847 void visitStaticFieldGet(Send node, FieldElement field, T arg) { 1907 void visitStaticFieldGet(Send node, FieldElement field, T arg) {
1848 handleStatic(node); 1908 handleStatic(node);
1849 } 1909 }
1850 1910
1851 void visitStaticFieldSet(SendSet node, FieldElement field, Node rhs, T arg) { 1911 void visitStaticFieldSet(SendSet node, FieldElement field, Node rhs, T arg) {
1852 handleStatic(node); 1912 handleStatic(node);
1853 } 1913 }
(...skipping 20 matching lines...) Expand all
1874 void visitStaticGetterSet( 1934 void visitStaticGetterSet(
1875 SendSet node, FunctionElement getter, Node rhs, T arg) { 1935 SendSet node, FunctionElement getter, Node rhs, T arg) {
1876 handleStatic(node); 1936 handleStatic(node);
1877 } 1937 }
1878 1938
1879 void visitStaticSetterSet( 1939 void visitStaticSetterSet(
1880 SendSet node, FunctionElement setter, Node rhs, T arg) { 1940 SendSet node, FunctionElement setter, Node rhs, T arg) {
1881 handleStatic(node); 1941 handleStatic(node);
1882 } 1942 }
1883 1943
1884 void visitStaticGetterSetterSetIfNull( 1944 void visitStaticGetterSetterSetIfNull(Send node, FunctionElement getter,
1885 Send node, 1945 FunctionElement setter, Node rhs, T arg) {
1886 FunctionElement getter,
1887 FunctionElement setter,
1888 Node rhs,
1889 T arg) {
1890 handleStatic(node); 1946 handleStatic(node);
1891 handleStatic(node); 1947 handleStatic(node);
1892 } 1948 }
1893 1949
1894 void visitStaticMethodSetterSetIfNull( 1950 void visitStaticMethodSetterSetIfNull(
1895 Send node, 1951 Send node, MethodElement method, MethodElement setter, Node rhs, T arg) {
1896 MethodElement method,
1897 MethodElement setter,
1898 Node rhs,
1899 T arg) {
1900 handleStatic(node); 1952 handleStatic(node);
1901 handleStatic(node); 1953 handleStatic(node);
1902 } 1954 }
1903 1955
1904 void visitStaticMethodSetIfNull( 1956 void visitStaticMethodSetIfNull(
1905 Send node, 1957 Send node, FunctionElement method, Node rhs, T arg) {
1906 FunctionElement method,
1907 Node rhs,
1908 T arg) {
1909 handleStatic(node); 1958 handleStatic(node);
1910 handleNSMError(node); 1959 handleNSMError(node);
1911 } 1960 }
1912 1961
1913 void visitTopLevelFieldGet(Send node, FieldElement field, T arg) { 1962 void visitTopLevelFieldGet(Send node, FieldElement field, T arg) {
1914 handleStatic(node); 1963 handleStatic(node);
1915 } 1964 }
1916 1965
1917 void visitTopLevelFieldSet( 1966 void visitTopLevelFieldSet(
1918 SendSet node, FieldElement field, Node rhs, T arg) { 1967 SendSet node, FieldElement field, Node rhs, T arg) {
(...skipping 19 matching lines...) Expand all
1938 handleStatic(node); 1987 handleStatic(node);
1939 } 1988 }
1940 1989
1941 void visitTopLevelSetterSet( 1990 void visitTopLevelSetterSet(
1942 SendSet node, FunctionElement setter, Node rhs, T arg) { 1991 SendSet node, FunctionElement setter, Node rhs, T arg) {
1943 handleStatic(node); 1992 handleStatic(node);
1944 } 1993 }
1945 1994
1946 // Virtual 1995 // Virtual
1947 1996
1948 void visitSuperCompoundIndexSet(SendSet node, MethodElement getter, 1997 void visitSuperCompoundIndexSet(
1949 MethodElement setter, Node index, AssignmentOperator operator, Node rhs, 1998 SendSet node,
1999 MethodElement getter,
2000 MethodElement setter,
2001 Node index,
2002 AssignmentOperator operator,
2003 Node rhs,
1950 T arg) { 2004 T arg) {
1951 handleSuper(node); 2005 handleSuper(node);
1952 handleOperator(node); 2006 handleOperator(node);
1953 handleSuper(node); 2007 handleSuper(node);
1954 } 2008 }
1955 2009
1956 void visitThisGet(Identifier node, T arg) { 2010 void visitThisGet(Identifier node, T arg) {
1957 handleLocal(node); // TODO(sigmund): should we add a metric for "this"? 2011 handleLocal(node); // TODO(sigmund): should we add a metric for "this"?
1958 } 2012 }
1959 2013
(...skipping 26 matching lines...) Expand all
1986 void errorUndefinedBinaryExpression( 2040 void errorUndefinedBinaryExpression(
1987 Send node, Node left, Operator operator, Node right, T arg) { 2041 Send node, Node left, Operator operator, Node right, T arg) {
1988 handleNoSend(node); 2042 handleNoSend(node);
1989 } 2043 }
1990 2044
1991 void errorUndefinedUnaryExpression( 2045 void errorUndefinedUnaryExpression(
1992 Send node, Operator operator, Node expression, T arg) { 2046 Send node, Operator operator, Node expression, T arg) {
1993 handleNoSend(node); 2047 handleNoSend(node);
1994 } 2048 }
1995 2049
1996 void errorInvalidGet( 2050 void errorInvalidGet(Send node, ErroneousElement error, T arg) {
1997 Send node,
1998 ErroneousElement error,
1999 T arg) {
2000 handleNoSend(node); 2051 handleNoSend(node);
2001 } 2052 }
2002 2053
2003 void errorInvalidInvoke( 2054 void errorInvalidInvoke(Send node, ErroneousElement error, NodeList arguments,
2004 Send node, 2055 Selector selector, T arg) {
2005 ErroneousElement error,
2006 NodeList arguments,
2007 Selector selector,
2008 T arg) {
2009 handleNoSend(node); 2056 handleNoSend(node);
2010 } 2057 }
2011 2058
2012 void errorInvalidSet( 2059 void errorInvalidSet(Send node, ErroneousElement error, Node rhs, T arg) {
2013 Send node,
2014 ErroneousElement error,
2015 Node rhs,
2016 T arg) {
2017 handleNoSend(node); 2060 handleNoSend(node);
2018 } 2061 }
2019 2062
2020 void errorInvalidSetIfNull( 2063 void errorInvalidSetIfNull(
2021 Send node, ErroneousElement error, Node rhs, T arg) { 2064 Send node, ErroneousElement error, Node rhs, T arg) {
2022 handleNoSend(node); 2065 handleNoSend(node);
2023 handleNoSend(node); 2066 handleNoSend(node);
2024 } 2067 }
2025 2068
2026
2027 void errorInvalidPrefix( 2069 void errorInvalidPrefix(
2028 Send node, 2070 Send node, ErroneousElement error, IncDecOperator operator, T arg) {
2029 ErroneousElement error,
2030 IncDecOperator operator,
2031 T arg) {
2032 handleNoSend(node); 2071 handleNoSend(node);
2033 } 2072 }
2034 2073
2035 void errorInvalidPostfix( 2074 void errorInvalidPostfix(
2036 Send node, 2075 Send node, ErroneousElement error, IncDecOperator operator, T arg) {
2037 ErroneousElement error,
2038 IncDecOperator operator,
2039 T arg) {
2040 handleNoSend(node); 2076 handleNoSend(node);
2041 } 2077 }
2042 2078
2043 void errorInvalidCompound( 2079 void errorInvalidCompound(Send node, ErroneousElement error,
2044 Send node, 2080 AssignmentOperator operator, Node rhs, T arg) {
2045 ErroneousElement error,
2046 AssignmentOperator operator,
2047 Node rhs,
2048 T arg) {
2049 handleNoSend(node); 2081 handleNoSend(node);
2050 } 2082 }
2051 2083
2052 void errorInvalidUnary( 2084 void errorInvalidUnary(
2053 Send node, 2085 Send node, UnaryOperator operator, ErroneousElement error, T arg) {
2054 UnaryOperator operator,
2055 ErroneousElement error,
2056 T arg) {
2057 handleNoSend(node); 2086 handleNoSend(node);
2058 } 2087 }
2059 2088
2060 void errorInvalidEquals( 2089 void errorInvalidEquals(
2061 Send node, 2090 Send node, ErroneousElement error, Node right, T arg) {
2062 ErroneousElement error,
2063 Node right,
2064 T arg) {
2065 handleNoSend(node); 2091 handleNoSend(node);
2066 } 2092 }
2067 2093
2068 void errorInvalidNotEquals( 2094 void errorInvalidNotEquals(
2069 Send node, 2095 Send node, ErroneousElement error, Node right, T arg) {
2070 ErroneousElement error,
2071 Node right,
2072 T arg) {
2073 handleNoSend(node); 2096 handleNoSend(node);
2074 } 2097 }
2075 2098
2076 void errorInvalidBinary( 2099 void errorInvalidBinary(Send node, ErroneousElement error,
2077 Send node, 2100 BinaryOperator operator, Node right, T arg) {
2078 ErroneousElement error,
2079 BinaryOperator operator,
2080 Node right,
2081 T arg) {
2082 handleNoSend(node); 2101 handleNoSend(node);
2083 } 2102 }
2084 2103
2085 void errorInvalidIndex( 2104 void errorInvalidIndex(Send node, ErroneousElement error, Node index, T arg) {
2086 Send node,
2087 ErroneousElement error,
2088 Node index,
2089 T arg) {
2090 handleNoSend(node); 2105 handleNoSend(node);
2091 } 2106 }
2092 2107
2093 void errorInvalidIndexSet( 2108 void errorInvalidIndexSet(
2094 Send node, 2109 Send node, ErroneousElement error, Node index, Node rhs, T arg) {
2095 ErroneousElement error,
2096 Node index,
2097 Node rhs,
2098 T arg) {
2099 handleNoSend(node); 2110 handleNoSend(node);
2100 } 2111 }
2101 2112
2102 void errorInvalidCompoundIndexSet( 2113 void errorInvalidCompoundIndexSet(Send node, ErroneousElement error,
2103 Send node, 2114 Node index, AssignmentOperator operator, Node rhs, T arg) {
2104 ErroneousElement error,
2105 Node index,
2106 AssignmentOperator operator,
2107 Node rhs,
2108 T arg) {
2109 handleNoSend(node); 2115 handleNoSend(node);
2110 handleNoSend(node); 2116 handleNoSend(node);
2111 handleNoSend(node); 2117 handleNoSend(node);
2112 } 2118 }
2113 2119
2114 void errorInvalidIndexPrefix( 2120 void errorInvalidIndexPrefix(Send node, ErroneousElement error, Node index,
2115 Send node, 2121 IncDecOperator operator, T arg) {
2116 ErroneousElement error,
2117 Node index,
2118 IncDecOperator operator,
2119 T arg) {
2120 handleNoSend(node); 2122 handleNoSend(node);
2121 handleNoSend(node); 2123 handleNoSend(node);
2122 } 2124 }
2123 2125
2124 void errorInvalidIndexPostfix( 2126 void errorInvalidIndexPostfix(Send node, ErroneousElement error, Node index,
2125 Send node, 2127 IncDecOperator operator, T arg) {
2126 ErroneousElement error,
2127 Node index,
2128 IncDecOperator operator,
2129 T arg) {
2130 handleNoSend(node); 2128 handleNoSend(node);
2131 handleNoSend(node); 2129 handleNoSend(node);
2132 } 2130 }
2133 2131
2134 void previsitDeferredAccess( 2132 void previsitDeferredAccess(Send node, PrefixElement prefix, T arg) {}
2135 Send node,
2136 PrefixElement prefix,
2137 T arg) {
2138 }
2139
2140 2133
2141 void visitAs(Send node, Node expression, DartType type, T arg) { 2134 void visitAs(Send node, Node expression, DartType type, T arg) {
2142 handleNoSend(node); 2135 handleNoSend(node);
2143 } 2136 }
2144 2137
2145 void visitClassTypeLiteralCompound(Send node, ConstantExpression constant, 2138 void visitClassTypeLiteralCompound(Send node, ConstantExpression constant,
2146 AssignmentOperator operator, Node rhs, T arg) { 2139 AssignmentOperator operator, Node rhs, T arg) {
2147 handleStatic(node); 2140 handleStatic(node);
2148 handleNSMError(node); 2141 handleNSMError(node);
2149 handleNoSend(node); 2142 handleNoSend(node);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 handleNSMError(node); 2212 handleNSMError(node);
2220 } 2213 }
2221 2214
2222 void visitDynamicTypeLiteralSetIfNull( 2215 void visitDynamicTypeLiteralSetIfNull(
2223 SendSet node, ConstantExpression constant, Node rhs, T arg) { 2216 SendSet node, ConstantExpression constant, Node rhs, T arg) {
2224 handleStatic(node); 2217 handleStatic(node);
2225 handleNSMError(node); 2218 handleNSMError(node);
2226 } 2219 }
2227 2220
2228 @override 2221 @override
2229 errorInvalidIndexSetIfNull(SendSet node, ErroneousElement error, Node index, 2222 errorInvalidIndexSetIfNull(
2230 Node rhs, T arg) { 2223 SendSet node, ErroneousElement error, Node index, Node rhs, T arg) {
2231 handleNoSend(node); 2224 handleNoSend(node);
2232 } 2225 }
2233 2226
2234 @override 2227 @override
2235 visitIndexSetIfNull(SendSet node, Node receiver, Node index, Node rhs, 2228 visitIndexSetIfNull(
2236 T arg) { 2229 SendSet node, Node receiver, Node index, Node rhs, T arg) {
2237 handleIndex(node); // t1 = receiver[index] 2230 handleIndex(node); // t1 = receiver[index]
2238 handleIndex(node); // receiver[index] = t2 2231 handleIndex(node); // receiver[index] = t2
2239 } 2232 }
2240 2233
2241 @override 2234 @override
2242 visitSuperIndexSetIfNull(SendSet node, MethodElement getter, 2235 visitSuperIndexSetIfNull(SendSet node, MethodElement getter,
2243 MethodElement setter, Node index, Node rhs, T arg) { 2236 MethodElement setter, Node index, Node rhs, T arg) {
2244 handleSuper(node); // t1 = super[index] 2237 handleSuper(node); // t1 = super[index]
2245 handleSuper(node); // super[index] = t2 2238 handleSuper(node); // super[index] = t2
2246 } 2239 }
2247 2240
2248 @override 2241 @override
2249 visitUnresolvedSuperGetterIndexSetIfNull(Send node, Element element, 2242 visitUnresolvedSuperGetterIndexSetIfNull(Send node, Element element,
2250 MethodElement setter, Node index, Node rhs, T arg) { 2243 MethodElement setter, Node index, Node rhs, T arg) {
2251 handleNSMSuper(node, element.enclosingClass); 2244 handleNSMSuper(node, element.enclosingClass);
2252 handleNSMSuper(node, element.enclosingClass); 2245 handleNSMSuper(node, element.enclosingClass);
2253 } 2246 }
2254 2247
2255 @override 2248 @override
2256 visitUnresolvedSuperIndexSetIfNull(Send node, Element element, Node index, 2249 visitUnresolvedSuperIndexSetIfNull(
2257 Node rhs, T arg) { 2250 Send node, Element element, Node index, Node rhs, T arg) {
2258 handleNSMSuper(node, element.enclosingClass); 2251 handleNSMSuper(node, element.enclosingClass);
2259 handleNSMSuper(node, element.enclosingClass); 2252 handleNSMSuper(node, element.enclosingClass);
2260 } 2253 }
2261 2254
2262 @override 2255 @override
2263 visitUnresolvedSuperSetterIndexSetIfNull(Send node, MethodElement getter, 2256 visitUnresolvedSuperSetterIndexSetIfNull(Send node, MethodElement getter,
2264 Element element, Node index, Node rhs, T arg) { 2257 Element element, Node index, Node rhs, T arg) {
2265 handleSuper(node); // t1 = super[index] 2258 handleSuper(node); // t1 = super[index]
2266 handleNSMSuper(node, element.enclosingClass); 2259 handleNSMSuper(node, element.enclosingClass);
2267 } 2260 }
(...skipping 21 matching lines...) Expand all
2289 void visitNot(Send node, Node expression, T arg) { 2282 void visitNot(Send node, Node expression, T arg) {
2290 handleNoSend(node); 2283 handleNoSend(node);
2291 } 2284 }
2292 2285
2293 String last; 2286 String last;
2294 _checkInvariant(node, String msg) { 2287 _checkInvariant(node, String msg) {
2295 msg = '$msg ${recursiveDiagnosticString(measurements, Metric.send)}'; 2288 msg = '$msg ${recursiveDiagnosticString(measurements, Metric.send)}';
2296 if (!measurements.checkInvariant(Metric.send) || 2289 if (!measurements.checkInvariant(Metric.send) ||
2297 !measurements.checkInvariant(Metric.monomorphicSend) || 2290 !measurements.checkInvariant(Metric.monomorphicSend) ||
2298 !measurements.checkInvariant(Metric.polymorphicSend)) { 2291 !measurements.checkInvariant(Metric.polymorphicSend)) {
2299 reporter.reportErrorMessage(node, 2292 reporter.reportErrorMessage(node, MessageKind.GENERIC,
2300 MessageKind.GENERIC, {'text': 'bad\n-- $msg\nlast:\n-- $last\n'}); 2293 {'text': 'bad\n-- $msg\nlast:\n-- $last\n'});
2301 last = msg; 2294 last = msg;
2302 } else { 2295 } else {
2303 last = msg; 2296 last = msg;
2304 } 2297 }
2305 } 2298 }
2306 } 2299 }
2307 2300
2308 /// Visitor that collects statistics for a single function. 2301 /// Visitor that collects statistics for a single function.
2309 class _StatsTraversalVisitor<T> extends TraversalVisitor<dynamic, T> 2302 class _StatsTraversalVisitor<T> extends TraversalVisitor<dynamic, T>
2310 implements SemanticSendVisitor<dynamic, T> { 2303 implements SemanticSendVisitor<dynamic, T> {
2311 final DiagnosticReporter reporter; 2304 final DiagnosticReporter reporter;
2312 final _StatsVisitor statsVisitor; 2305 final _StatsVisitor statsVisitor;
2313 Measurements get measurements => statsVisitor.measurements; 2306 Measurements get measurements => statsVisitor.measurements;
2314 _StatsTraversalVisitor( 2307 _StatsTraversalVisitor(
2315 Compiler compiler, TreeElements elements, Uri sourceUri) 2308 Compiler compiler, TreeElements elements, Uri sourceUri)
2316 : reporter = compiler.reporter, 2309 : reporter = compiler.reporter,
2317 statsVisitor = new _StatsVisitor(compiler.reporter, elements, 2310 statsVisitor = new _StatsVisitor(
2318 // TODO(sigmund): accept a list of analyses, so we can compare them 2311 compiler.reporter,
2319 // together. 2312 elements,
2320 true 2313 // TODO(sigmund): accept a list of analyses, so we can compare t hem
2321 ? new TrustTypesAnalysisResult(elements, compiler.world) 2314 // together.
2322 : new NaiveAnalysisResult(), 2315 true
2316 ? new TrustTypesAnalysisResult(elements, compiler.world)
2317 : new NaiveAnalysisResult(),
2323 sourceUri), 2318 sourceUri),
2324 super(elements); 2319 super(elements);
2325 2320
2326 void visitSend(Send node) { 2321 void visitSend(Send node) {
2327 try { 2322 try {
2328 node.accept(statsVisitor); 2323 node.accept(statsVisitor);
2329 } catch (e, t) { 2324 } catch (e, t) {
2330 reporter.reportErrorMessage( 2325 reporter
2331 node, MessageKind.GENERIC, {'text': '$e\n$t'}); 2326 .reportErrorMessage(node, MessageKind.GENERIC, {'text': '$e\n$t'});
2332 } 2327 }
2333 super.visitSend(node); 2328 super.visitSend(node);
2334 } 2329 }
2335 2330
2336 void visitNewExpression(NewExpression node) { 2331 void visitNewExpression(NewExpression node) {
2337 try { 2332 try {
2338 node.accept(statsVisitor); 2333 node.accept(statsVisitor);
2339 } catch (e, t) { 2334 } catch (e, t) {
2340 reporter.reportErrorMessage( 2335 reporter
2341 node, MessageKind.GENERIC, {'text': '$e\n$t'}); 2336 .reportErrorMessage(node, MessageKind.GENERIC, {'text': '$e\n$t'});
2342 } 2337 }
2343 super.visitNewExpression(node); 2338 super.visitNewExpression(node);
2344 } 2339 }
2345 } 2340 }
2346 2341
2347 /// Helper to visit elements recursively 2342 /// Helper to visit elements recursively
2348 // TODO(sigmund): maybe generalize and move to elements/visitor.dart? 2343 // TODO(sigmund): maybe generalize and move to elements/visitor.dart?
2349 abstract class RecursiveElementVisitor<R, A> extends ElementVisitor<R, A> { 2344 abstract class RecursiveElementVisitor<R, A> extends ElementVisitor<R, A> {
2350
2351 @override 2345 @override
2352 R visitWarnOnUseElement(WarnOnUseElement e, A arg) => 2346 R visitWarnOnUseElement(WarnOnUseElement e, A arg) =>
2353 e.wrappedElement.accept(this, arg); 2347 e.wrappedElement.accept(this, arg);
2354 2348
2355 R visitScopeContainerElement(ScopeContainerElement e, A arg) { 2349 R visitScopeContainerElement(ScopeContainerElement e, A arg) {
2356 e.forEachLocalMember((l) => l.accept(this, arg)); 2350 e.forEachLocalMember((l) => l.accept(this, arg));
2357 return null; 2351 return null;
2358 } 2352 }
2359 2353
2360 @override 2354 @override
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 @override 2415 @override
2422 R visitClosureFieldElement(ClosureFieldElement e, A arg) { 2416 R visitClosureFieldElement(ClosureFieldElement e, A arg) {
2423 return visitVariableElement(e, arg); 2417 return visitVariableElement(e, arg);
2424 } 2418 }
2425 } 2419 }
2426 2420
2427 // TODO(sigmund): get rid of debug messages. 2421 // TODO(sigmund): get rid of debug messages.
2428 _debug(String message) { 2422 _debug(String message) {
2429 print('debug: $message'); 2423 print('debug: $message');
2430 } 2424 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/info/naive_analysis_result.dart ('k') | pkg/compiler/lib/src/info/trusted_types_analysis_result.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698