OLD | NEW |
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 library dart2js.send_structure; | 5 library dart2js.send_structure; |
6 | 6 |
7 import 'access_semantics.dart'; | 7 import 'access_semantics.dart'; |
8 import 'operators.dart'; | 8 import 'operators.dart'; |
9 import 'semantic_visitor.dart'; | 9 import 'semantic_visitor.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 callStructure, | 326 callStructure, |
327 arg); | 327 arg); |
328 case AccessKind.CONSTANT: | 328 case AccessKind.CONSTANT: |
329 return visitor.visitConstantInvoke( | 329 return visitor.visitConstantInvoke( |
330 node, | 330 node, |
331 semantics.constant, | 331 semantics.constant, |
332 node.argumentsNode, | 332 node.argumentsNode, |
333 callStructure, | 333 callStructure, |
334 arg); | 334 arg); |
335 case AccessKind.UNRESOLVED: | 335 case AccessKind.UNRESOLVED: |
336 return visitor.errorUnresolvedInvoke( | 336 return visitor.visitUnresolvedInvoke( |
337 node, | 337 node, |
338 semantics.element, | 338 semantics.element, |
339 node.argumentsNode, | 339 node.argumentsNode, |
340 selector, | 340 selector, |
341 arg); | 341 arg); |
342 case AccessKind.UNRESOLVED_SUPER: | 342 case AccessKind.UNRESOLVED_SUPER: |
343 return visitor.visitUnresolvedSuperInvoke( | 343 return visitor.visitUnresolvedSuperInvoke( |
344 node, | 344 node, |
345 semantics.element, | 345 semantics.element, |
346 node.argumentsNode, | 346 node.argumentsNode, |
(...skipping 20 matching lines...) Expand all Loading... |
367 final Selector selector; | 367 final Selector selector; |
368 | 368 |
369 /// The [CallStructure] of the invocation. | 369 /// The [CallStructure] of the invocation. |
370 // TODO(johnniwinther): Store this directly for static invocations. | 370 // TODO(johnniwinther): Store this directly for static invocations. |
371 CallStructure get callStructure => selector.callStructure; | 371 CallStructure get callStructure => selector.callStructure; |
372 | 372 |
373 IncompatibleInvokeStructure(this.semantics, this.selector); | 373 IncompatibleInvokeStructure(this.semantics, this.selector); |
374 | 374 |
375 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 375 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
376 switch (semantics.kind) { | 376 switch (semantics.kind) { |
| 377 case AccessKind.STATIC_METHOD: |
| 378 return visitor.visitStaticFunctionIncompatibleInvoke( |
| 379 node, |
| 380 semantics.element, |
| 381 node.argumentsNode, |
| 382 callStructure, |
| 383 arg); |
377 case AccessKind.SUPER_METHOD: | 384 case AccessKind.SUPER_METHOD: |
378 return visitor.visitSuperMethodIncompatibleInvoke( | 385 return visitor.visitSuperMethodIncompatibleInvoke( |
379 node, | 386 node, |
380 semantics.element, | 387 semantics.element, |
381 node.argumentsNode, | 388 node.argumentsNode, |
382 callStructure, | 389 callStructure, |
383 arg); | 390 arg); |
384 default: | 391 case AccessKind.TOPLEVEL_METHOD: |
| 392 return visitor.visitTopLevelFunctionIncompatibleInvoke( |
| 393 node, |
| 394 semantics.element, |
| 395 node.argumentsNode, |
| 396 callStructure, |
| 397 arg); |
| 398 default: |
385 // TODO(johnniwinther): Support more variants of this invoke structure. | 399 // TODO(johnniwinther): Support more variants of this invoke structure. |
386 break; | 400 break; |
387 } | 401 } |
388 throw new SpannableAssertionFailure( | 402 throw new SpannableAssertionFailure( |
389 node, "Invalid incompatible invoke: ${semantics}"); | 403 node, "Invalid incompatible invoke: ${semantics}"); |
390 } | 404 } |
391 | 405 |
392 String toString() => 'incompatible-invoke($selector, $semantics)'; | 406 String toString() => 'incompatible-invoke($selector, $semantics)'; |
393 } | 407 } |
394 | 408 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 return visitor.errorSuperSetterGet( | 529 return visitor.errorSuperSetterGet( |
516 node, | 530 node, |
517 semantics.element, | 531 semantics.element, |
518 arg); | 532 arg); |
519 case AccessKind.CONSTANT: | 533 case AccessKind.CONSTANT: |
520 return visitor.visitConstantGet( | 534 return visitor.visitConstantGet( |
521 node, | 535 node, |
522 semantics.constant, | 536 semantics.constant, |
523 arg); | 537 arg); |
524 case AccessKind.UNRESOLVED: | 538 case AccessKind.UNRESOLVED: |
525 return visitor.errorUnresolvedGet( | 539 return visitor.visitUnresolvedGet( |
526 node, | 540 node, |
527 semantics.element, | 541 semantics.element, |
528 arg); | 542 arg); |
529 case AccessKind.UNRESOLVED_SUPER: | 543 case AccessKind.UNRESOLVED_SUPER: |
530 return visitor.visitUnresolvedSuperGet( | 544 return visitor.visitUnresolvedSuperGet( |
531 node, | 545 node, |
532 semantics.element, | 546 semantics.element, |
533 arg); | 547 arg); |
534 case AccessKind.COMPOUND: | 548 case AccessKind.COMPOUND: |
535 // This is not a valid case. | 549 // This is not a valid case. |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 final ConstructorElement constructor; | 2163 final ConstructorElement constructor; |
2150 final Selector selector; | 2164 final Selector selector; |
2151 | 2165 |
2152 ThisConstructorInvokeStructure(this.constructor, this.selector); | 2166 ThisConstructorInvokeStructure(this.constructor, this.selector); |
2153 | 2167 |
2154 R dispatch(SemanticDeclarationVisitor<R, A> visitor, Send node, A arg) { | 2168 R dispatch(SemanticDeclarationVisitor<R, A> visitor, Send node, A arg) { |
2155 return visitor.visitThisConstructorInvoke( | 2169 return visitor.visitThisConstructorInvoke( |
2156 node, constructor, node.argumentsNode, selector, arg); | 2170 node, constructor, node.argumentsNode, selector, arg); |
2157 } | 2171 } |
2158 } | 2172 } |
OLD | NEW |