OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:convert'; | 5 import 'dart:convert'; |
6 | 6 |
7 import 'package:analyzer/src/codegen/tools.dart'; | 7 import 'package:analyzer/src/codegen/tools.dart'; |
8 import 'package:front_end/src/codegen/tools.dart'; | 8 import 'package:front_end/src/codegen/tools.dart'; |
9 import 'package:html/dom.dart' as dom; | 9 import 'package:html/dom.dart' as dom; |
10 | 10 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 }); | 549 }); |
550 writeln('}'); | 550 writeln('}'); |
551 } | 551 } |
552 } | 552 } |
553 | 553 |
554 /** | 554 /** |
555 * Emit the operator== code for an object class. | 555 * Emit the operator== code for an object class. |
556 */ | 556 */ |
557 void emitObjectEqualsMember(TypeObject type, String className) { | 557 void emitObjectEqualsMember(TypeObject type, String className) { |
558 writeln('@override'); | 558 writeln('@override'); |
559 writeln('bool operator==(other) {'); | 559 writeln('bool operator ==(other) {'); |
560 indent(() { | 560 indent(() { |
561 writeln('if (other is $className) {'); | 561 writeln('if (other is $className) {'); |
562 indent(() { | 562 indent(() { |
563 var comparisons = <String>[]; | 563 var comparisons = <String>[]; |
564 if (type != null) { | 564 if (type != null) { |
565 for (TypeObjectField field in type.fields) { | 565 for (TypeObjectField field in type.fields) { |
566 if (field.value != null) { | 566 if (field.value != null) { |
567 continue; | 567 continue; |
568 } | 568 } |
569 comparisons.add(compareEqualsCode( | 569 comparisons.add(compareEqualsCode( |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 | 1274 |
1275 @override | 1275 @override |
1276 String get asClosure => '($type value) => ${callback('value')}'; | 1276 String get asClosure => '($type value) => ${callback('value')}'; |
1277 | 1277 |
1278 @override | 1278 @override |
1279 bool get isIdentity => false; | 1279 bool get isIdentity => false; |
1280 | 1280 |
1281 @override | 1281 @override |
1282 String asSnippet(String value) => callback(value); | 1282 String asSnippet(String value) => callback(value); |
1283 } | 1283 } |
OLD | NEW |