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

Side by Side Diff: tool/input_sdk/lib/js/dart2js/js_dart2js.dart

Issue 1324693004: Fixes for Angular (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Reformat Created 5 years, 3 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
« lib/src/checker/resolver.dart ('K') | « lib/src/checker/resolver.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * Support for interoperating with JavaScript. 6 * Support for interoperating with JavaScript.
7 * 7 *
8 * This library provides access to JavaScript objects from Dart, allowing 8 * This library provides access to JavaScript objects from Dart, allowing
9 * Dart code to get and set properties, and call methods of JavaScript objects 9 * Dart code to get and set properties, and call methods of JavaScript objects
10 * and invoke JavaScript functions. The library takes care of converting 10 * and invoke JavaScript functions. The library takes care of converting
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 Object _convertToDart(o) { 477 Object _convertToDart(o) {
478 if (JS('bool', '# == null', o) || 478 if (JS('bool', '# == null', o) ||
479 JS('bool', 'typeof # == "string"', o) || 479 JS('bool', 'typeof # == "string"', o) ||
480 JS('bool', 'typeof # == "number"', o) || 480 JS('bool', 'typeof # == "number"', o) ||
481 JS('bool', 'typeof # == "boolean"', o) || 481 JS('bool', 'typeof # == "boolean"', o) ||
482 _isBrowserType(o)) { 482 _isBrowserType(o)) {
483 return o; 483 return o;
484 } else if (JS('bool', '# instanceof Date', o)) { 484 } else if (JS('bool', '# instanceof Date', o)) {
485 var ms = JS('num', '#.getTime()', o); 485 var ms = JS('num', '#.getTime()', o);
486 return new DateTime.fromMillisecondsSinceEpoch(ms); 486 return new DateTime.fromMillisecondsSinceEpoch(ms);
487 } else if (o is _DartObject) { 487 } else if (o is _DartObject &&
488 JS('bool', 'dart.jsobject != dart.realRuntimeType(#)', o)) {
vsm 2015/09/02 19:14:32 My earlier change had native JS objects returning
488 return o._dartObj; 489 return o._dartObj;
489 } else { 490 } else {
490 return _putIfAbsent(_dartProxies, o, _wrapToDart); 491 return _putIfAbsent(_dartProxies, o, _wrapToDart);
491 } 492 }
492 } 493 }
493 494
494 _wrapToDart(o) { 495 _wrapToDart(o) {
495 if (JS('bool', 'typeof # == "function"', o)) { 496 if (JS('bool', 'typeof # == "function"', o)) {
496 return new JsFunction._fromJs(o); 497 return new JsFunction._fromJs(o);
497 } 498 }
498 if (JS('bool', '# instanceof Array', o)) { 499 if (JS('bool', '# instanceof Array', o)) {
499 return new JsArray._fromJs(o); 500 return new JsArray._fromJs(o);
500 } 501 }
501 return new JsObject._fromJs(o); 502 return new JsObject._fromJs(o);
502 } 503 }
503 504
504 final _dartProxies = JS('', 'new WeakMap()'); 505 final _dartProxies = JS('', 'new WeakMap()');
505 final _jsProxies = JS('', 'new WeakMap()'); 506 final _jsProxies = JS('', 'new WeakMap()');
506 507
507 Object _putIfAbsent(weakMap, o, getValue(o)) { 508 Object _putIfAbsent(weakMap, o, getValue(o)) {
508 var value = JS('', '#.get(#)', weakMap, o); 509 var value = JS('', '#.get(#)', weakMap, o);
509 if (value == null) { 510 if (value == null) {
510 value = getValue(o); 511 value = getValue(o);
511 JS('', '#.set(#, #)', weakMap, o, value); 512 JS('', '#.set(#, #)', weakMap, o, value);
512 } 513 }
513 return value; 514 return value;
514 } 515 }
OLDNEW
« lib/src/checker/resolver.dart ('K') | « lib/src/checker/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698