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

Side by Side Diff: test/codegen/expect/collection/src/canonicalized_map.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
OLDNEW
1 dart_library.library('collection/src/canonicalized_map', null, /* Imports */[ 1 dart_library.library('collection/src/canonicalized_map', null, /* Imports */[
2 "dart/_runtime", 2 'dart/_runtime',
3 'dart/core', 3 'dart/core',
4 'collection/src/utils', 4 'collection/src/utils',
5 'dart/collection' 5 'dart/collection'
6 ], /* Lazy imports */[ 6 ], /* Lazy imports */[
7 ], function(exports, dart, core, utils, collection) { 7 ], function(exports, dart, core, utils, collection) {
8 'use strict'; 8 'use strict';
9 let dartx = dart.dartx; 9 let dartx = dart.dartx;
10 const _base = Symbol('_base'); 10 const _base = Symbol('_base');
11 const _canonicalize = Symbol('_canonicalize'); 11 const _canonicalize = Symbol('_canonicalize');
12 const _isValidKeyFn = Symbol('_isValidKeyFn'); 12 const _isValidKeyFn = Symbol('_isValidKeyFn');
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 dart.as(f, dart.functionType(dart.void, [K, V])); 55 dart.as(f, dart.functionType(dart.void, [K, V]));
56 this[_base].forEach(dart.fn((key, pair) => f(pair.first, pair.last), dar t.void, [C, utils.Pair$(K, V)])); 56 this[_base].forEach(dart.fn((key, pair) => f(pair.first, pair.last), dar t.void, [C, utils.Pair$(K, V)]));
57 } 57 }
58 get isEmpty() { 58 get isEmpty() {
59 return this[_base].isEmpty; 59 return this[_base].isEmpty;
60 } 60 }
61 get isNotEmpty() { 61 get isNotEmpty() {
62 return this[_base].isNotEmpty; 62 return this[_base].isNotEmpty;
63 } 63 }
64 get keys() { 64 get keys() {
65 return this[_base].values[dartx.map](dart.fn(pair => pair.first, K, [uti ls.Pair$(K, V)])); 65 return dart.as(this[_base].values[dartx.map](dart.fn(pair => pair.first, K, [utils.Pair$(K, V)])), core.Iterable$(K));
66 } 66 }
67 get length() { 67 get length() {
68 return this[_base].length; 68 return this[_base].length;
69 } 69 }
70 putIfAbsent(key, ifAbsent) { 70 putIfAbsent(key, ifAbsent) {
71 dart.as(key, K); 71 dart.as(key, K);
72 dart.as(ifAbsent, dart.functionType(V, [])); 72 dart.as(ifAbsent, dart.functionType(V, []));
73 return this[_base].putIfAbsent(dart.as(dart.dcall(this[_canonicalize], k ey), C), dart.fn(() => new (utils.Pair$(K, V))(key, ifAbsent()), utils.Pair$(K, V), [])).last; 73 return this[_base].putIfAbsent(dart.as(dart.dcall(this[_canonicalize], k ey), C), dart.fn(() => new (utils.Pair$(K, V))(key, ifAbsent()), utils.Pair$(K, V), [])).last;
74 } 74 }
75 remove(key) { 75 remove(key) {
76 if (!dart.notNull(this[_isValidKey](key))) return null; 76 if (!dart.notNull(this[_isValidKey](key))) return null;
77 let pair = this[_base].remove(dart.dcall(this[_canonicalize], key)); 77 let pair = this[_base].remove(dart.dcall(this[_canonicalize], key));
78 return pair == null ? null : pair.last; 78 return pair == null ? null : pair.last;
79 } 79 }
80 get values() { 80 get values() {
81 return this[_base].values[dartx.map](dart.fn(pair => pair.last, V, [util s.Pair$(K, V)])); 81 return dart.as(this[_base].values[dartx.map](dart.fn(pair => pair.last, V, [utils.Pair$(K, V)])), core.Iterable$(V));
82 } 82 }
83 toString() { 83 toString() {
84 return collection.Maps.mapToString(this); 84 return collection.Maps.mapToString(this);
85 } 85 }
86 [_isValidKey](key) { 86 [_isValidKey](key) {
87 return (key == null || dart.is(key, K)) && (this[_isValidKeyFn] == null || dart.notNull(dart.as(dart.dcall(this[_isValidKeyFn], key), core.bool))); 87 return (key == null || dart.is(key, K)) && (this[_isValidKeyFn] == null || dart.notNull(dart.as(dart.dcall(this[_isValidKeyFn], key), core.bool)));
88 } 88 }
89 } 89 }
90 CanonicalizedMap[dart.implements] = () => [core.Map$(K, V)]; 90 CanonicalizedMap[dart.implements] = () => [core.Map$(K, V)];
91 dart.defineNamedConstructor(CanonicalizedMap, 'from'); 91 dart.defineNamedConstructor(CanonicalizedMap, 'from');
(...skipping 15 matching lines...) Expand all
107 [_isValidKey]: [core.bool, [core.Object]] 107 [_isValidKey]: [core.bool, [core.Object]]
108 }) 108 })
109 }); 109 });
110 return CanonicalizedMap; 110 return CanonicalizedMap;
111 }); 111 });
112 let CanonicalizedMap = CanonicalizedMap$(); 112 let CanonicalizedMap = CanonicalizedMap$();
113 // Exports: 113 // Exports:
114 exports.CanonicalizedMap$ = CanonicalizedMap$; 114 exports.CanonicalizedMap$ = CanonicalizedMap$;
115 exports.CanonicalizedMap = CanonicalizedMap; 115 exports.CanonicalizedMap = CanonicalizedMap;
116 }); 116 });
OLDNEW
« no previous file with comments | « test/codegen/expect/collection/priority_queue.js ('k') | test/codegen/expect/collection/src/canonicalized_map.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698