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

Side by Side Diff: pkg/compiler/lib/src/resolution/send_structure.dart

Issue 1342213003: Add optional message to assert in Dart2js - continued (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add --assert-message flag Created 5 years, 3 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 library dart2js.resolution.send_structure; 5 library dart2js.resolution.send_structure;
6 6
7 import '../dart_types.dart'; 7 import '../dart_types.dart';
8 import '../diagnostics/spannable.dart' show 8 import '../diagnostics/spannable.dart' show
9 SpannableAssertionFailure; 9 SpannableAssertionFailure;
10 import '../constants/expressions.dart'; 10 import '../constants/expressions.dart';
(...skipping 17 matching lines...) Expand all
28 28
29 /// Interface for the structure of the semantics of a [Send] node. 29 /// Interface for the structure of the semantics of a [Send] node.
30 /// 30 ///
31 /// Subclasses handle each of the [Send] variations; `assert(e)`, `a && b`, 31 /// Subclasses handle each of the [Send] variations; `assert(e)`, `a && b`,
32 /// `a.b`, `a.b(c)`, etc. 32 /// `a.b`, `a.b(c)`, etc.
33 abstract class SendStructure<R, A> extends SemanticSendStructure<R, A> { 33 abstract class SendStructure<R, A> extends SemanticSendStructure<R, A> {
34 /// Calls the matching visit method on [visitor] with [send] and [arg]. 34 /// Calls the matching visit method on [visitor] with [send] and [arg].
35 R dispatch(SemanticSendVisitor<R, A> visitor, Send send, A arg); 35 R dispatch(SemanticSendVisitor<R, A> visitor, Send send, A arg);
36 } 36 }
37 37
38 /// The structure for a [Send] of the form `assert(e)`.
39 class AssertStructure<R, A> implements SendStructure<R, A> {
40 const AssertStructure();
41
42 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) {
43 return visitor.visitAssert(
44 node,
45 node.arguments.single,
46 arg);
47 }
48
49 String toString() => 'assert';
50 }
51
52 /// The structure for a [Send] of the form an `assert` with less or more than
53 /// one argument.
54 class InvalidAssertStructure<R, A> implements SendStructure<R, A> {
55 const InvalidAssertStructure();
56
57 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) {
58 return visitor.errorInvalidAssert(
59 node,
60 node.argumentsNode,
61 arg);
62 }
63
64 String toString() => 'invalid assert';
65 }
66
67 /// The structure for a [Send] of the form `a ?? b`. 38 /// The structure for a [Send] of the form `a ?? b`.
68 class IfNullStructure<R, A> implements SendStructure<R, A> { 39 class IfNullStructure<R, A> implements SendStructure<R, A> {
69 const IfNullStructure(); 40 const IfNullStructure();
70 41
71 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { 42 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) {
72 return visitor.visitIfNull( 43 return visitor.visitIfNull(
73 node, 44 node,
74 node.receiver, 45 node.receiver,
75 node.arguments.single, 46 node.arguments.single,
76 arg); 47 arg);
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 ThisConstructorInvokeStructure( 2950 ThisConstructorInvokeStructure(
2980 this.node, this.constructor, this.callStructure); 2951 this.node, this.constructor, this.callStructure);
2981 2952
2982 R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg) { 2953 R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg) {
2983 return visitor.visitThisConstructorInvoke( 2954 return visitor.visitThisConstructorInvoke(
2984 node, constructor, node.argumentsNode, callStructure, arg); 2955 node, constructor, node.argumentsNode, callStructure, arg);
2985 } 2956 }
2986 2957
2987 bool get isConstructorInvoke => true; 2958 bool get isConstructorInvoke => true;
2988 } 2959 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart ('k') | pkg/compiler/lib/src/resolution/tree_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698