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

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

Issue 1718353002: Fixes #460 (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « lib/runtime/dart/js.js ('k') | tool/sdk_expected_errors.txt » ('j') | 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 /** 114 /**
115 * Constructs a new JavaScript object from [constructor] and returns a proxy 115 * Constructs a new JavaScript object from [constructor] and returns a proxy
116 * to it. 116 * to it.
117 */ 117 */
118 factory JsObject(JsFunction constructor, [List arguments]) { 118 factory JsObject(JsFunction constructor, [List arguments]) {
119 var ctor = constructor._jsObject; 119 var ctor = constructor._jsObject;
120 if (arguments == null) { 120 if (arguments == null) {
121 return _wrapToDart(JS('', 'new #()', ctor)); 121 return _wrapToDart(JS('', 'new #()', ctor));
122 } 122 }
123 return _wrapToDart(JS('', 'new #(...#)', ctor, arguments)); 123 var unwrapped = new List.from(arguments.map(_convertToJS));
124 return _wrapToDart(JS('', 'new #(...#)', ctor, unwrapped));
124 } 125 }
125 126
126 /** 127 /**
127 * Constructs a [JsObject] that proxies a native Dart object; _for expert use 128 * Constructs a [JsObject] that proxies a native Dart object; _for expert use
128 * only_. 129 * only_.
129 * 130 *
130 * Use this constructor only if you wish to get access to JavaScript 131 * Use this constructor only if you wish to get access to JavaScript
131 * properties attached to a browser host object, such as a Node or Blob, that 132 * properties attached to a browser host object, such as a Node or Blob, that
132 * is normally automatically converted into a native Dart object. 133 * is normally automatically converted into a native Dart object.
133 * 134 *
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 ' for (let arg of arguments) {' 550 ' for (let arg of arguments) {'
550 ' args.push(arg);' 551 ' args.push(arg);'
551 ' }' 552 ' }'
552 ' return #(...args);' 553 ' return #(...args);'
553 '}', 554 '}',
554 f); 555 f);
555 _interopCaptureThisExpando[f] = ret; 556 _interopCaptureThisExpando[f] = ret;
556 } 557 }
557 return ret; 558 return ret;
558 } 559 }
OLDNEW
« no previous file with comments | « lib/runtime/dart/js.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698