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

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

Issue 1083763003: refactor emitMemberName to be used more consistently (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 let defineProperty = Object.defineProperty; 9 let defineProperty = Object.defineProperty;
10 let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 10 let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } else if (formals.length > args.length) { 61 } else if (formals.length > args.length) {
62 for (let i = args.length; i < formals.length; ++i) { 62 for (let i = args.length; i < formals.length; ++i) {
63 if (formals[i].indexOf("opt$") != 0) { 63 if (formals[i].indexOf("opt$") != 0) {
64 throwNoSuchMethod(obj, name, args, f); 64 throwNoSuchMethod(obj, name, args, f);
65 } 65 }
66 } 66 }
67 } 67 }
68 return f.apply(obj, args); 68 return f.apply(obj, args);
69 } 69 }
70 70
71 // TODO(jmesserly): rename to dcall?
71 function dinvokef(f/*, ...args*/) { 72 function dinvokef(f/*, ...args*/) {
Jacob 2015/04/13 23:19:35 dcall seems more consistent with dart. E.g class F
Jennifer Messerly 2015/04/14 21:21:00 +1 ... yeah planning to fix this in follow up, but
72 let args = Array.prototype.slice.call(arguments, 1); 73 let args = Array.prototype.slice.call(arguments, 1);
73 return checkAndCall(f, void 0, args, 'call'); 74 return checkAndCall(f, void 0, args, 'call');
74 } 75 }
75 dart.dinvokef = dinvokef; 76 dart.dinvokef = dinvokef;
76 77
77 function dinvoke(obj, method/*, ...args*/) { 78 function dsend(obj, method/*, ...args*/) {
78 let args = Array.prototype.slice.call(arguments, 2); 79 let args = Array.prototype.slice.call(arguments, 2);
79 return checkAndCall(obj[method], obj, args, method); 80 return checkAndCall(obj[method], obj, args, method);
80 } 81 }
81 dart.dinvoke = dinvoke; 82 dart.dsend = dsend;
82 83
83 function dindex(obj, index) { 84 function dindex(obj, index) {
84 return checkAndCall(obj.get, obj, [index], '[]'); 85 return checkAndCall(obj.get, obj, [index], '[]');
85 } 86 }
86 dart.dindex = dindex; 87 dart.dindex = dindex;
87 88
88 function dsetindex(obj, index, value) { 89 function dsetindex(obj, index, value) {
89 return checkAndCall(obj.set, obj, [index, value], '[]='); 90 return checkAndCall(obj.set, obj, [index, value], '[]=');
90 } 91 }
91 dart.dsetindex = dindex; 92 dart.dsetindex = dsetindex;
92
93 function dbinary(left, op, right) {
94 return checkAndCall(left[op], left, [right], op);
95 }
96 dart.dbinary = dbinary;
97 93
98 function cast(obj, type) { 94 function cast(obj, type) {
99 // TODO(vsm): handle non-nullable types 95 // TODO(vsm): handle non-nullable types
100 if (obj == null) return obj; 96 if (obj == null) return obj;
101 let actual = getRuntimeType(obj); 97 let actual = getRuntimeType(obj);
102 if (isSubtype(actual, type)) return obj; 98 if (isSubtype(actual, type)) return obj;
103 throw new _js_helper.CastErrorImplementation(actual, type); 99 throw new _js_helper.CastErrorImplementation(actual, type);
104 } 100 }
105 dart.as = cast; 101 dart.as = cast;
106 102
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 // TODO(vsm): How should we encode the runtime type? 752 // TODO(vsm): How should we encode the runtime type?
757 dart.runtimeType = Symbol('runtimeType'); 753 dart.runtimeType = Symbol('runtimeType');
758 754
759 dart.JsSymbol = Symbol; 755 dart.JsSymbol = Symbol;
760 756
761 // TODO(jmesserly): hack to bootstrap the SDK 757 // TODO(jmesserly): hack to bootstrap the SDK
762 _js_helper = _js_helper || {}; 758 _js_helper = _js_helper || {};
763 _js_helper.checkNum = notNull; 759 _js_helper.checkNum = notNull;
764 760
765 })(dart || (dart = {})); 761 })(dart || (dart = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698