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

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

Issue 1074923003: rename dart_runtime.js helpers (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
« no previous file with comments | « lib/runtime/dart/core.js ('k') | lib/src/codegen/js_codegen.dart » ('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 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 function dinvokef(f/*, ...args*/) { 71 function dcall(f/*, ...args*/) {
72 let args = Array.prototype.slice.call(arguments, 1); 72 let args = Array.prototype.slice.call(arguments, 1);
73 return checkAndCall(f, void 0, args, 'call'); 73 return checkAndCall(f, void 0, args, 'call');
74 } 74 }
75 dart.dinvokef = dinvokef; 75 dart.dcall = dcall;
76 76
77 function dinvoke(obj, method/*, ...args*/) { 77 function dsend(obj, method/*, ...args*/) {
78 let args = Array.prototype.slice.call(arguments, 2); 78 let args = Array.prototype.slice.call(arguments, 2);
79 return checkAndCall(obj[method], obj, args, method); 79 return checkAndCall(obj[method], obj, args, method);
80 } 80 }
81 dart.dinvoke = dinvoke; 81 dart.dinvoke = dsend;
82 82
83 function dindex(obj, index) { 83 function dindex(obj, index) {
84 return checkAndCall(obj.get, obj, [index], '[]'); 84 return checkAndCall(obj.get, obj, [index], '[]');
85 } 85 }
86 dart.dindex = dindex; 86 dart.dindex = dindex;
87 87
88 function dsetindex(obj, index, value) { 88 function dsetindex(obj, index, value) {
89 return checkAndCall(obj.set, obj, [index, value], '[]='); 89 return checkAndCall(obj.set, obj, [index, value], '[]=');
90 } 90 }
91 dart.dsetindex = dindex; 91 dart.dsetindex = dindex;
92 92
93 function dbinary(left, op, right) {
94 return checkAndCall(left[op], left, [right], op);
95 }
96 dart.dbinary = dbinary;
97
98 function cast(obj, type) { 93 function cast(obj, type) {
99 // TODO(vsm): handle non-nullable types 94 // TODO(vsm): handle non-nullable types
100 if (obj == null) return obj; 95 if (obj == null) return obj;
101 let actual = getRuntimeType(obj); 96 let actual = getRuntimeType(obj);
102 if (isSubtype(actual, type)) return obj; 97 if (isSubtype(actual, type)) return obj;
103 throw new _js_helper.CastErrorImplementation(actual, type); 98 throw new _js_helper.CastErrorImplementation(actual, type);
104 } 99 }
105 dart.as = cast; 100 dart.as = cast;
106 101
107 /** 102 /**
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 // TODO(vsm): How should we encode the runtime type? 751 // TODO(vsm): How should we encode the runtime type?
757 dart.runtimeType = Symbol('runtimeType'); 752 dart.runtimeType = Symbol('runtimeType');
758 753
759 dart.JsSymbol = Symbol; 754 dart.JsSymbol = Symbol;
760 755
761 // TODO(jmesserly): hack to bootstrap the SDK 756 // TODO(jmesserly): hack to bootstrap the SDK
762 _js_helper = _js_helper || {}; 757 _js_helper = _js_helper || {};
763 _js_helper.checkNum = notNull; 758 _js_helper.checkNum = notNull;
764 759
765 })(dart || (dart = {})); 760 })(dart || (dart = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/core.js ('k') | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698