OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 codegen.protocol; | 5 library codegen.protocol; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 | 8 |
9 import 'package:analyzer/src/codegen/tools.dart'; | 9 import 'package:analyzer/src/codegen/tools.dart'; |
10 import 'package:front_end/src/codegen/tools.dart'; | 10 import 'package:front_end/src/codegen/tools.dart'; |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 }); | 525 }); |
526 writeln('}'); | 526 writeln('}'); |
527 } | 527 } |
528 } | 528 } |
529 | 529 |
530 /** | 530 /** |
531 * Emit the operator== code for an object class. | 531 * Emit the operator== code for an object class. |
532 */ | 532 */ |
533 void emitObjectEqualsMember(TypeObject type, String className) { | 533 void emitObjectEqualsMember(TypeObject type, String className) { |
534 writeln('@override'); | 534 writeln('@override'); |
535 writeln('bool operator==(other) {'); | 535 writeln('bool operator ==(other) {'); |
536 indent(() { | 536 indent(() { |
537 writeln('if (other is $className) {'); | 537 writeln('if (other is $className) {'); |
538 indent(() { | 538 indent(() { |
539 var comparisons = <String>[]; | 539 var comparisons = <String>[]; |
540 if (type != null) { | 540 if (type != null) { |
541 for (TypeObjectField field in type.fields) { | 541 for (TypeObjectField field in type.fields) { |
542 if (field.value != null) { | 542 if (field.value != null) { |
543 continue; | 543 continue; |
544 } | 544 } |
545 comparisons.add(compareEqualsCode( | 545 comparisons.add(compareEqualsCode( |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 | 1241 |
1242 @override | 1242 @override |
1243 String get asClosure => '($type value) => ${callback('value')}'; | 1243 String get asClosure => '($type value) => ${callback('value')}'; |
1244 | 1244 |
1245 @override | 1245 @override |
1246 bool get isIdentity => false; | 1246 bool get isIdentity => false; |
1247 | 1247 |
1248 @override | 1248 @override |
1249 String asSnippet(String value) => callback(value); | 1249 String asSnippet(String value) => callback(value); |
1250 } | 1250 } |
OLD | NEW |