Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: lib/runtime/dart_runtime.js

Issue 1047023002: use == and != to enable handling null/undefined (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 var dart, _js_helper; 5 var dart, _js_helper;
6 (function (dart) { 6 (function (dart) {
7 'use strict'; 7 'use strict';
8 8
9 var defineProperty = Object.defineProperty; 9 var defineProperty = Object.defineProperty;
10 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 10 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 dart.isGroundType = isGroundType; 122 dart.isGroundType = isGroundType;
123 123
124 function arity(f) { 124 function arity(f) {
125 // TODO(vsm): Implement. 125 // TODO(vsm): Implement.
126 throw new core.UnimplementedError(); 126 throw new core.UnimplementedError();
127 } 127 }
128 dart.arity = arity; 128 dart.arity = arity;
129 129
130 function equals(x, y) { 130 function equals(x, y) {
131 if (x === null || y === null) return x === y; 131 if (x == null || y == null) return x == y;
132 var eq = x['==']; 132 var eq = x['=='];
133 return eq ? eq.call(x, y) : x === y; 133 return eq ? eq.call(x, y) : x == y;
134 } 134 }
135 dart.equals = equals; 135 dart.equals = equals;
136 136
137 /** Checks that `x` is not null or undefined. */ 137 /** Checks that `x` is not null or undefined. */
138 function notNull(x) { 138 function notNull(x) {
139 if (x == null) throw 'expected not-null value'; 139 if (x == null) throw 'expected not-null value';
140 return x; 140 return x;
141 } 141 }
142 dart.notNull = notNull; 142 dart.notNull = notNull;
143 143
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // of some sort, assuming we keep around `dynamic` at runtime. 339 // of some sort, assuming we keep around `dynamic` at runtime.
340 dart.dynamic = Object.create(null); 340 dart.dynamic = Object.create(null);
341 341
342 dart.JsSymbol = Symbol; 342 dart.JsSymbol = Symbol;
343 343
344 // TODO(jmesserly): hack to bootstrap the SDK 344 // TODO(jmesserly): hack to bootstrap the SDK
345 _js_helper = _js_helper || {}; 345 _js_helper = _js_helper || {};
346 _js_helper.checkNum = notNull; 346 _js_helper.checkNum = notNull;
347 347
348 })(dart || (dart = {})); 348 })(dart || (dart = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698