OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.class_hierarchy; | 4 library kernel.class_hierarchy; |
5 | 5 |
6 import 'ast.dart'; | 6 import 'ast.dart'; |
7 import 'dart:math'; | 7 import 'dart:math'; |
8 import 'dart:typed_data'; | 8 import 'dart:typed_data'; |
9 import 'type_algebra.dart'; | 9 import 'type_algebra.dart'; |
10 | 10 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 return members; | 394 return members; |
395 } | 395 } |
396 | 396 |
397 /// Computes the list of implemented members, based on the declared instance | 397 /// Computes the list of implemented members, based on the declared instance |
398 /// members and inherited instance members. | 398 /// members and inherited instance members. |
399 /// | 399 /// |
400 /// Both lists must be sorted by name beforehand. | 400 /// Both lists must be sorted by name beforehand. |
401 static List<Member> _inheritMembers( | 401 static List<Member> _inheritMembers( |
402 List<Member> declared, List<Member> inherited, | 402 List<Member> declared, List<Member> inherited, |
403 {bool skipAbstractMembers: false}) { | 403 {bool skipAbstractMembers: false}) { |
404 List<Member> result = <Member>[] | 404 List<Member> result = <Member>[]..length = |
405 ..length = declared.length + inherited.length; | 405 declared.length + inherited.length; |
406 // Since both lists are sorted, we can fuse them like in merge sort. | 406 // Since both lists are sorted, we can fuse them like in merge sort. |
407 int storeIndex = 0; | 407 int storeIndex = 0; |
408 int i = 0, j = 0; | 408 int i = 0, j = 0; |
409 while (i < declared.length && j < inherited.length) { | 409 while (i < declared.length && j < inherited.length) { |
410 Member declaredMember = declared[i]; | 410 Member declaredMember = declared[i]; |
411 Member inheritedMember = inherited[j]; | 411 Member inheritedMember = inherited[j]; |
412 if (skipAbstractMembers && declaredMember.isAbstract) { | 412 if (skipAbstractMembers && declaredMember.isAbstract) { |
413 ++i; | 413 ++i; |
414 continue; | 414 continue; |
415 } | 415 } |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 | 893 |
894 ClassSet union(ClassSet other) { | 894 ClassSet union(ClassSet other) { |
895 assert(_hierarchy == other._hierarchy); | 895 assert(_hierarchy == other._hierarchy); |
896 if (identical(_intervalList, other._intervalList)) return this; | 896 if (identical(_intervalList, other._intervalList)) return this; |
897 _IntervalListBuilder builder = new _IntervalListBuilder(); | 897 _IntervalListBuilder builder = new _IntervalListBuilder(); |
898 builder.addIntervalList(_intervalList); | 898 builder.addIntervalList(_intervalList); |
899 builder.addIntervalList(other._intervalList); | 899 builder.addIntervalList(other._intervalList); |
900 return new ClassSet(_hierarchy, builder.buildIntervalList()); | 900 return new ClassSet(_hierarchy, builder.buildIntervalList()); |
901 } | 901 } |
902 } | 902 } |
OLD | NEW |