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

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

Issue 1071393007: fuse List and js Array together and a few other misc fixes. (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: ptal 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;
11 let getOwnPropertyNames = Object.getOwnPropertyNames; 11 let getOwnPropertyNames = Object.getOwnPropertyNames;
12 let getOwnPropertySymbols = Object.getOwnPropertySymbols;
12 13
13 // Adapted from Angular.js 14 // Adapted from Angular.js
14 let FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; 15 let FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
15 let FN_ARG_SPLIT = /,/; 16 let FN_ARG_SPLIT = /,/;
16 let FN_ARG = /^\s*(_?)(\S+?)\1\s*$/; 17 let FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
17 let STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; 18 let STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
18 19
19 function formalParameterList(fn) { 20 function formalParameterList(fn) {
20 let fnText,argDecl; 21 let fnText,argDecl;
21 let args=[]; 22 let args=[];
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 // TODO(jmesserly): these are identical, but this makes it easier to grep for. 608 // TODO(jmesserly): these are identical, but this makes it easier to grep for.
608 dart.defineLazyClass = defineLazy; 609 dart.defineLazyClass = defineLazy;
609 dart.defineLazyProperties = defineLazy; 610 dart.defineLazyProperties = defineLazy;
610 dart.defineLazyClassGeneric = defineLazyProperty; 611 dart.defineLazyClassGeneric = defineLazyProperty;
611 612
612 /** 613 /**
613 * Copy properties from source to destination object. 614 * Copy properties from source to destination object.
614 * This operation is commonly called `mixin` in JS. 615 * This operation is commonly called `mixin` in JS.
615 */ 616 */
616 function copyProperties(to, from) { 617 function copyProperties(to, from) {
617 let names = getOwnPropertyNames(from); 618 function copyPropertiesHelper(names) {
618 for (let i = 0; i < names.length; i++) { 619 for (let i = 0; i < names.length; i++) {
619 let name = names[i]; 620 let name = names[i];
620 defineProperty(to, name, getOwnPropertyDescriptor(from, name)); 621 defineProperty(to, name, getOwnPropertyDescriptor(from, name));
622 }
621 } 623 }
624 copyPropertiesHelper(getOwnPropertyNames(from));
625 copyPropertiesHelper(getOwnPropertySymbols(from));
622 return to; 626 return to;
623 } 627 }
624 dart.copyProperties = copyProperties; 628 dart.copyProperties = copyProperties;
625 629
626 /** 630 /**
627 * This is called whenever a derived class needs to introduce a new field, 631 * This is called whenever a derived class needs to introduce a new field,
628 * shadowing a field or getter/setter pair on its parent. 632 * shadowing a field or getter/setter pair on its parent.
629 * 633 *
630 * This is important because otherwise, trying to read or write the field 634 * This is important because otherwise, trying to read or write the field
631 * would end up calling the getter or setter, and one of those might not even 635 * would end up calling the getter or setter, and one of those might not even
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 obj[runtimeType] = type; 801 obj[runtimeType] = type;
798 } 802 }
799 dart.setType = setType; 803 dart.setType = setType;
800 804
801 // TODO(jmesserly): right now this is a sentinel. It should be a type object 805 // TODO(jmesserly): right now this is a sentinel. It should be a type object
802 // of some sort, assuming we keep around `dynamic` at runtime. 806 // of some sort, assuming we keep around `dynamic` at runtime.
803 dart.dynamic = { toString() { return 'dynamic'; } }; 807 dart.dynamic = { toString() { return 'dynamic'; } };
804 dart.void = { toString() { return 'void'; } }; 808 dart.void = { toString() { return 'void'; } };
805 dart.bottom = { toString() { return 'bottom'; } }; 809 dart.bottom = { toString() { return 'bottom'; } };
806 810
811 dart.global = window || global;
807 dart.JsSymbol = Symbol; 812 dart.JsSymbol = Symbol;
808 813
809 // TODO(jmesserly): hack to bootstrap the SDK 814 // TODO(jmesserly): hack to bootstrap the SDK
810 _js_helper = _js_helper || {}; 815 _js_helper = _js_helper || {};
811 _js_helper.checkNum = notNull; 816 _js_helper.checkNum = notNull;
812 817
813 })(dart || (dart = {})); 818 })(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