OLD | NEW |
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 /// This library defines runtime operations on objects used by the code | 5 /// This library defines runtime operations on objects used by the code |
6 /// generator. | 6 /// generator. |
7 part of dart._runtime; | 7 part of dart._runtime; |
8 | 8 |
9 class InvocationImpl extends Invocation { | 9 class InvocationImpl extends Invocation { |
10 final Symbol memberName; | 10 final Symbol memberName; |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 return result; | 851 return result; |
852 }; | 852 }; |
853 let count = $elements.length; | 853 let count = $elements.length; |
854 let map = lookupNonTerminal($constantLists, count); | 854 let map = lookupNonTerminal($constantLists, count); |
855 for (let i = 0; i < count; i++) { | 855 for (let i = 0; i < count; i++) { |
856 map = lookupNonTerminal(map, elements[i]); | 856 map = lookupNonTerminal(map, elements[i]); |
857 } | 857 } |
858 let value = map.get($elementType); | 858 let value = map.get($elementType); |
859 if (value) return value; | 859 if (value) return value; |
860 | 860 |
861 value = $setType($elements, ${getGenericClass(JSArray)}($elementType)); | 861 ${getGenericClass(JSArray)}($elementType).unmodifiable($elements); |
862 map.set($elementType, value); | 862 map.set($elementType, elements); |
863 return value; | 863 return elements; |
864 })()'''); | 864 })()'''); |
865 | 865 |
866 // The following are helpers for Object methods when the receiver | 866 // The following are helpers for Object methods when the receiver |
867 // may be null or primitive. These should only be generated by | 867 // may be null or primitive. These should only be generated by |
868 // the compiler. | 868 // the compiler. |
869 hashCode(obj) { | 869 hashCode(obj) { |
870 if (obj == null) return 0; | 870 if (obj == null) return 0; |
871 | 871 |
872 switch (JS('String', 'typeof #', obj)) { | 872 switch (JS('String', 'typeof #', obj)) { |
873 case "number": | 873 case "number": |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 /// Libraries are not actually deferred in DDC, so this just returns a future | 994 /// Libraries are not actually deferred in DDC, so this just returns a future |
995 /// that completes immediately. | 995 /// that completes immediately. |
996 Future loadLibrary() => new Future.value(); | 996 Future loadLibrary() => new Future.value(); |
997 | 997 |
998 /// Defines lazy statics. | 998 /// Defines lazy statics. |
999 void defineLazy(to, from) { | 999 void defineLazy(to, from) { |
1000 for (var name in getOwnNamesAndSymbols(from)) { | 1000 for (var name in getOwnNamesAndSymbols(from)) { |
1001 defineLazyProperty(to, name, getOwnPropertyDescriptor(from, name)); | 1001 defineLazyProperty(to, name, getOwnPropertyDescriptor(from, name)); |
1002 } | 1002 } |
1003 } | 1003 } |
OLD | NEW |