| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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("dart:core"); | 5 #library("dart:core"); |
| 6 #import("dart:coreimpl"); | 6 #import("dart:coreimpl"); |
| 7 | 7 |
| 8 // TODO(jimhug): Better way to map in standard corelib | 8 // TODO(jimhug): Better way to map in standard corelib |
| 9 #source("../../corelib/src/bool.dart"); | 9 #source("../../corelib/src/bool.dart"); |
| 10 #source("../../corelib/src/collection.dart"); | 10 #source("../../corelib/src/collection.dart"); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // Dart core library. | 112 // Dart core library. |
| 113 | 113 |
| 114 class Object native "Object" { | 114 class Object native "Object" { |
| 115 | 115 |
| 116 const Object() native; | 116 const Object() native; |
| 117 | 117 |
| 118 bool operator ==(Object other) native; | 118 bool operator ==(Object other) native; |
| 119 String toString() native; | 119 String toString() native; |
| 120 | 120 |
| 121 // TODO(jmesserly): optimize this. No need to call it. | 121 // TODO(jmesserly): optimize this. No need to call it, unless it's overridden. |
| 122 get dynamic() => this; | 122 // Notes: "use strict" prevents boxing. |
| 123 // The Dart "return this" might help with type inference. |
| 124 get dynamic() native '"use strict"; return this;' { return this; } |
| 123 | 125 |
| 124 // TODO(jmesserly): add named args. For now stay compatible with the VM. | 126 // TODO(jmesserly): add named args. For now stay compatible with the VM. |
| 125 noSuchMethod(String name, List args) { | 127 noSuchMethod(String name, List args) { |
| 126 throw new NoSuchMethodException(this, name, args); | 128 throw new NoSuchMethodException(this, name, args); |
| 127 } | 129 } |
| 128 } | 130 } |
| 129 | 131 |
| 130 LinkedHashMapImplementation _map(List itemsAndKeys) { | 132 LinkedHashMapImplementation _map(List itemsAndKeys) { |
| 131 LinkedHashMapImplementation ret = new LinkedHashMapImplementation(); | 133 LinkedHashMapImplementation ret = new LinkedHashMapImplementation(); |
| 132 for (int i=0; i < itemsAndKeys.length;) { | 134 for (int i=0; i < itemsAndKeys.length;) { |
| 133 ret[itemsAndKeys[i++]] = itemsAndKeys[i++]; | 135 ret[itemsAndKeys[i++]] = itemsAndKeys[i++]; |
| 134 } | 136 } |
| 135 return ret; | 137 return ret; |
| 136 } | 138 } |
| 137 | 139 |
| 138 ImmutableMap _constMap(List itemsAndKeys) { | 140 ImmutableMap _constMap(List itemsAndKeys) { |
| 139 return new ImmutableMap(itemsAndKeys); | 141 return new ImmutableMap(itemsAndKeys); |
| 140 } | 142 } |
| 141 | 143 |
| 142 void _assert(var test, String text, String url, int line, int column) { | 144 void _assert(var test, String text, String url, int line, int column) { |
| 143 if (test is Function) test = test(); | 145 if (test is Function) test = test(); |
| 144 if (!test) throw new AssertionError._internal(text, url, line, column); | 146 if (!test) throw new AssertionError._internal(text, url, line, column); |
| 145 } | 147 } |
| OLD | NEW |