Chromium Code Reviews

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

Issue 1152903003: Create SendStructure for unary and binary in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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.operators; 5 library dart2js.operators;
6 6
7 import '../elements/elements.dart'; 7 import '../elements/elements.dart';
8 import '../universe/universe.dart';
8 9
9 enum UnaryOperatorKind { 10 enum UnaryOperatorKind {
10 NOT, 11 NOT,
11 NEGATE, 12 NEGATE,
12 COMPLEMENT, 13 COMPLEMENT,
13 } 14 }
14 15
15 class UnaryOperator { 16 class UnaryOperator {
16 final UnaryOperatorKind kind; 17 final UnaryOperatorKind kind;
17 final String name; 18 final String name;
18 final String selectorName; 19 final String selectorName;
19 20
20 const UnaryOperator(this.kind, this.name, this.selectorName); 21 const UnaryOperator(this.kind, this.name, this.selectorName);
21 22
22 bool get isUserDefinable => selectorName != null; 23 bool get isUserDefinable => selectorName != null;
23 24
25 Selector get selector => new Selector(
26 SelectorKind.OPERATOR,
27 new PublicName(selectorName),
28 CallStructure.NO_ARGS);
29
24 String toString() => name; 30 String toString() => name;
25 31
26 /// The unary ! operator. 32 /// The unary ! operator.
27 static const UnaryOperator NOT = 33 static const UnaryOperator NOT =
28 const UnaryOperator(UnaryOperatorKind.NOT, '!', null); 34 const UnaryOperator(UnaryOperatorKind.NOT, '!', null);
29 35
30 /// The unary - operator. 36 /// The unary - operator.
31 static const UnaryOperator NEGATE = 37 static const UnaryOperator NEGATE =
32 const UnaryOperator(UnaryOperatorKind.NEGATE, '-', 'unary-'); 38 const UnaryOperator(UnaryOperatorKind.NEGATE, '-', 'unary-');
33 39
(...skipping 309 matching lines...)
343 const IncDecOperator._(IncDecOperatorKind.DEC, '--', BinaryOperator.SUB); 349 const IncDecOperator._(IncDecOperatorKind.DEC, '--', BinaryOperator.SUB);
344 350
345 static IncDecOperator parse(String value) { 351 static IncDecOperator parse(String value) {
346 switch (value) { 352 switch (value) {
347 case '++': return INC; 353 case '++': return INC;
348 case '--': return DEC; 354 case '--': return DEC;
349 default: return null; 355 default: return null;
350 } 356 }
351 } 357 }
352 } 358 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine