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

Side by Side Diff: lib/runtime/dart/_utils.js

Issue 1530563003: Generate all runtime files from dart. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged master Created 4 years, 11 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/_types.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 dart_library.library('dart/_utils', null, /* Imports */[
2 ], /* Lazy imports */[
3 ], function(exports, dart) {
4 'use strict';
5 const defineProperty = Object.defineProperty;
6 const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
7 const getOwnPropertyNames = Object.getOwnPropertyNames;
8 const getOwnPropertySymbols = Object.getOwnPropertySymbols;
9 const hasOwnProperty = Object.prototype.hasOwnProperty;
10 const StrongModeError = (function() {
11 function StrongModeError(message) {
12 Error.call(this);
13 this.message = message;
14 }
15 ;
16 Object.setPrototypeOf(StrongModeError.prototype, Error.prototype);
17 return StrongModeError;
18 })();
19 function throwStrongModeError(message) {
20 throw new StrongModeError(message);
21 }
22 function throwInternalError(message) {
23 throw Error(message);
24 }
25 function assert(condition) {
26 if (!condition) throwInternalError("The compiler is broken: failed assert");
27 }
28 function getOwnNamesAndSymbols(obj) {
29 return getOwnPropertyNames(obj).concat(getOwnPropertySymbols(obj));
30 }
31 function safeGetOwnProperty(obj, name) {
32 let desc = getOwnPropertyDescriptor(obj, name);
33 if (desc) return desc.value;
34 }
35 function defineLazyProperty(to, name, desc) {
36 let init = desc.get;
37 let value = null;
38 function lazySetter(x) {
39 init = null;
40 value = x;
41 }
42 function circularInitError() {
43 throwInternalError('circular initialization for field ' + name);
44 }
45 function lazyGetter() {
46 if (init == null) return value;
47 let f = init;
48 init = circularInitError;
49 lazySetter(f());
50 return value;
51 }
52 desc.get = lazyGetter;
53 desc.configurable = true;
54 if (desc.set) desc.set = lazySetter;
55 return defineProperty(to, name, desc);
56 }
57 function defineLazy(to, from) {
58 for (let name of getOwnNamesAndSymbols(from)) {
59 defineLazyProperty(to, name, getOwnPropertyDescriptor(from, name));
60 }
61 }
62 function defineMemoizedGetter(obj, name, getter) {
63 return defineLazyProperty(obj, name, {get: getter});
64 }
65 function copyTheseProperties(to, from, names) {
66 for (let name of names) {
67 var desc = getOwnPropertyDescriptor(from, name);
68 if (desc != void 0) {
69 defineProperty(to, name, desc);
70 } else {
71 defineLazyProperty(to, name, () => from[name]);
72 }
73 }
74 return to;
75 }
76 function copyProperties(to, from) {
77 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from));
78 }
79 function export_(to, from, show, hide) {
80 if (show == void 0 || show.length == 0) {
81 show = getOwnNamesAndSymbols(from);
82 }
83 if (hide != void 0) {
84 var hideMap = new Set(hide);
85 show = show.filter(k => !hideMap.has(k));
86 }
87 return copyTheseProperties(to, from, show);
88 }
89 // Exports:
90 exports.defineProperty = defineProperty;
91 exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor;
92 exports.getOwnPropertyNames = getOwnPropertyNames;
93 exports.getOwnPropertySymbols = getOwnPropertySymbols;
94 exports.hasOwnProperty = hasOwnProperty;
95 exports.StrongModeError = StrongModeError;
96 exports.throwStrongModeError = throwStrongModeError;
97 exports.throwInternalError = throwInternalError;
98 exports.assert = assert;
99 exports.getOwnNamesAndSymbols = getOwnNamesAndSymbols;
100 exports.safeGetOwnProperty = safeGetOwnProperty;
101 exports.defineLazyProperty = defineLazyProperty;
102 exports.defineLazy = defineLazy;
103 exports.defineMemoizedGetter = defineMemoizedGetter;
104 exports.copyTheseProperties = copyTheseProperties;
105 exports.copyProperties = copyProperties;
106 exports.export_ = export_;
107 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/_types.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698