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

Side by Side Diff: test/codegen_expected/matcher/matcher.js

Issue 2211293002: Reify type params on map literals (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Remove unnecessary null check Created 4 years, 4 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 | « test/codegen_expected/map_keys.js ('k') | test/codegen_expected/stack_trace/stack_trace.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('matcher', null, /* Imports */[ 1 dart_library.library('matcher', null, /* Imports */[
2 'dart_sdk' 2 'dart_sdk'
3 ], function load__matcher(exports, dart_sdk) { 3 ], function load__matcher(exports, dart_sdk) {
4 'use strict'; 4 'use strict';
5 const core = dart_sdk.core; 5 const core = dart_sdk.core;
6 const mirrors = dart_sdk.mirrors; 6 const mirrors = dart_sdk.mirrors;
7 const _interceptors = dart_sdk._interceptors; 7 const _interceptors = dart_sdk._interceptors;
8 const dart = dart_sdk.dart; 8 const dart = dart_sdk.dart;
9 const dartx = dart_sdk.dartx; 9 const dartx = dart_sdk.dartx;
10 const matcher = Object.create(null); 10 const matcher = Object.create(null);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 this[_featureName] = featureName; 139 this[_featureName] = featureName;
140 this[_matcher] = src__util.wrapMatcher(matcher); 140 this[_matcher] = src__util.wrapMatcher(matcher);
141 super.new(); 141 super.new();
142 } 142 }
143 featureValueOf(actual) { 143 featureValueOf(actual) {
144 return actual; 144 return actual;
145 } 145 }
146 matches(item, matchState) { 146 matches(item, matchState) {
147 let f = this.featureValueOf(item); 147 let f = this.featureValueOf(item);
148 if (dart.test(this[_matcher].matches(f, matchState))) return true; 148 if (dart.test(this[_matcher].matches(f, matchState))) return true;
149 src__util.addStateInfo(matchState, dart.map({feature: f})); 149 src__util.addStateInfo(matchState, dart.map({feature: f}, core.String, dar t.dynamic));
150 return false; 150 return false;
151 } 151 }
152 describe(description) { 152 describe(description) {
153 return description.add(this[_featureDescription]).add(' ').addDescriptionO f(this[_matcher]); 153 return description.add(this[_featureDescription]).add(' ').addDescriptionO f(this[_matcher]);
154 } 154 }
155 describeMismatch(item, mismatchDescription, matchState, verbose) { 155 describeMismatch(item, mismatchDescription, matchState, verbose) {
156 mismatchDescription.add('has ').add(this[_featureName]).add(' with value ' ).addDescriptionOf(matchState[dartx.get]('feature')); 156 mismatchDescription.add('has ').add(this[_featureName]).add(' with value ' ).addDescriptionOf(matchState[dartx.get]('feature'));
157 let innerDescription = new src__description.StringDescription(); 157 let innerDescription = new src__description.StringDescription();
158 this[_matcher].describeMismatch(matchState[dartx.get]('feature'), innerDes cription, core.Map._check(matchState[dartx.get]('state')), verbose); 158 this[_matcher].describeMismatch(matchState[dartx.get]('feature'), innerDes cription, core.Map._check(matchState[dartx.get]('state')), verbose);
159 if (dart.notNull(innerDescription.length) > 0) { 159 if (dart.notNull(innerDescription.length) > 0) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 src__core_matchers._ReturnsNormally = class _ReturnsNormally extends src__inte rfaces.Matcher { 278 src__core_matchers._ReturnsNormally = class _ReturnsNormally extends src__inte rfaces.Matcher {
279 new() { 279 new() {
280 super.new(); 280 super.new();
281 } 281 }
282 matches(f, matchState) { 282 matches(f, matchState) {
283 try { 283 try {
284 dart.dcall(f); 284 dart.dcall(f);
285 return true; 285 return true;
286 } catch (e) { 286 } catch (e) {
287 let s = dart.stackTrace(e); 287 let s = dart.stackTrace(e);
288 src__util.addStateInfo(matchState, dart.map({exception: e, stack: s})); 288 src__util.addStateInfo(matchState, dart.map({exception: e, stack: s}, co re.String, dart.dynamic));
289 return false; 289 return false;
290 } 290 }
291 291
292 } 292 }
293 describe(description) { 293 describe(description) {
294 return description.add("return normally"); 294 return description.add("return normally");
295 } 295 }
296 describeMismatch(item, mismatchDescription, matchState, verbose) { 296 describeMismatch(item, mismatchDescription, matchState, verbose) {
297 mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get](' exception')); 297 mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get](' exception'));
298 if (dart.test(verbose)) { 298 if (dart.test(verbose)) {
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 this[_name$] = name; 886 this[_name$] = name;
887 this[_matcher$] = matcher; 887 this[_matcher$] = matcher;
888 super.new(); 888 super.new();
889 } 889 }
890 matches(item, matchState) { 890 matches(item, matchState) {
891 let mirror = mirrors.reflect(item); 891 let mirror = mirrors.reflect(item);
892 let classMirror = mirror.type; 892 let classMirror = mirror.type;
893 let symbol = core.Symbol.new(this[_name$]); 893 let symbol = core.Symbol.new(this[_name$]);
894 let candidate = classMirror.declarations[dartx.get](symbol); 894 let candidate = classMirror.declarations[dartx.get](symbol);
895 if (candidate == null) { 895 if (candidate == null) {
896 src__util.addStateInfo(matchState, dart.map({reason: dart.str`has no pro perty named "${this[_name$]}"`})); 896 src__util.addStateInfo(matchState, dart.map({reason: dart.str`has no pro perty named "${this[_name$]}"`}, core.String, core.String));
897 return false; 897 return false;
898 } 898 }
899 let isInstanceField = mirrors.VariableMirror.is(candidate) && !dart.test(c andidate.isStatic); 899 let isInstanceField = mirrors.VariableMirror.is(candidate) && !dart.test(c andidate.isStatic);
900 let isInstanceGetter = mirrors.MethodMirror.is(candidate) && dart.test(can didate.isGetter) && !dart.test(candidate.isStatic); 900 let isInstanceGetter = mirrors.MethodMirror.is(candidate) && dart.test(can didate.isGetter) && !dart.test(candidate.isStatic);
901 if (!(isInstanceField || isInstanceGetter)) { 901 if (!(isInstanceField || isInstanceGetter)) {
902 src__util.addStateInfo(matchState, dart.map({reason: dart.str`has a memb er named "${this[_name$]}", but it is not an instance property`})); 902 src__util.addStateInfo(matchState, dart.map({reason: dart.str`has a memb er named "${this[_name$]}", but it is not an instance property`}, core.String, c ore.String));
903 return false; 903 return false;
904 } 904 }
905 if (this[_matcher$] == null) return true; 905 if (this[_matcher$] == null) return true;
906 let result = mirror.getField(symbol); 906 let result = mirror.getField(symbol);
907 let resultMatches = this[_matcher$].matches(result.reflectee, matchState); 907 let resultMatches = this[_matcher$].matches(result.reflectee, matchState);
908 if (!dart.test(resultMatches)) { 908 if (!dart.test(resultMatches)) {
909 src__util.addStateInfo(matchState, dart.map({value: result.reflectee})); 909 src__util.addStateInfo(matchState, dart.map({value: result.reflectee}, c ore.String, dart.dynamic));
910 } 910 }
911 return resultMatches; 911 return resultMatches;
912 } 912 }
913 describe(description) { 913 describe(description) {
914 description.add(dart.str`has property "${this[_name$]}"`); 914 description.add(dart.str`has property "${this[_name$]}"`);
915 if (this[_matcher$] != null) { 915 if (this[_matcher$] != null) {
916 description.add(' which matches ').addDescriptionOf(this[_matcher$]); 916 description.add(' which matches ').addDescriptionOf(this[_matcher$]);
917 } 917 }
918 return description; 918 return description;
919 } 919 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 let reason = null; 1057 let reason = null;
1058 if (dart.test(dart.dsend(dart.dload(rp[dartx.get](0), 'length'), '>', 0))) { 1058 if (dart.test(dart.dsend(dart.dload(rp[dartx.get](0), 'length'), '>', 0))) {
1059 if (dart.test(dart.dsend(dart.dload(rp[dartx.get](1), 'length'), '>', 0) )) { 1059 if (dart.test(dart.dsend(dart.dload(rp[dartx.get](1), 'length'), '>', 0) )) {
1060 reason = dart.str`${rp[dartx.get](0)} at location ${rp[dartx.get](1)}` ; 1060 reason = dart.str`${rp[dartx.get](0)} at location ${rp[dartx.get](1)}` ;
1061 } else { 1061 } else {
1062 reason = rp[dartx.get](0); 1062 reason = rp[dartx.get](0);
1063 } 1063 }
1064 } else { 1064 } else {
1065 reason = ''; 1065 reason = '';
1066 } 1066 }
1067 src__util.addStateInfo(matchState, dart.map({reason: reason})); 1067 src__util.addStateInfo(matchState, dart.map({reason: reason}, core.String, dart.dynamic));
1068 return core.String._check(reason); 1068 return core.String._check(reason);
1069 } 1069 }
1070 matches(item, matchState) { 1070 matches(item, matchState) {
1071 return this[_match](this[_expected], item, matchState) == null; 1071 return this[_match](this[_expected], item, matchState) == null;
1072 } 1072 }
1073 describe(description) { 1073 describe(description) {
1074 return description.addDescriptionOf(this[_expected]); 1074 return description.addDescriptionOf(this[_expected]);
1075 } 1075 }
1076 describeMismatch(item, mismatchDescription, matchState, verbose) { 1076 describeMismatch(item, mismatchDescription, matchState, verbose) {
1077 let reason = matchState[dartx.get]('reason'); 1077 let reason = matchState[dartx.get]('reason');
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 this[_matcher$0] = matcher; 1319 this[_matcher$0] = matcher;
1320 super.new(); 1320 super.new();
1321 } 1321 }
1322 matches(item, matchState) { 1322 matches(item, matchState) {
1323 if (!core.Iterable.is(item)) { 1323 if (!core.Iterable.is(item)) {
1324 return false; 1324 return false;
1325 } 1325 }
1326 let i = 0; 1326 let i = 0;
1327 for (let element of core.Iterable._check(item)) { 1327 for (let element of core.Iterable._check(item)) {
1328 if (!dart.test(this[_matcher$0].matches(element, matchState))) { 1328 if (!dart.test(this[_matcher$0].matches(element, matchState))) {
1329 src__util.addStateInfo(matchState, dart.map({index: i, element: elemen t})); 1329 src__util.addStateInfo(matchState, dart.map({index: i, element: elemen t}, core.String, dart.dynamic));
1330 return false; 1330 return false;
1331 } 1331 }
1332 ++i; 1332 ++i;
1333 } 1333 }
1334 return true; 1334 return true;
1335 } 1335 }
1336 describe(description) { 1336 describe(description) {
1337 return description.add('every element(').addDescriptionOf(this[_matcher$0] ).add(')'); 1337 return description.add('every element(').addDescriptionOf(this[_matcher$0] ).add(')');
1338 } 1338 }
1339 describeMismatch(item, mismatchDescription, matchState, verbose) { 1339 describeMismatch(item, mismatchDescription, matchState, verbose) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 super.new(); 1487 super.new();
1488 } 1488 }
1489 matches(item, matchState) { 1489 matches(item, matchState) {
1490 if (!core.Iterable.is(item)) return false; 1490 if (!core.Iterable.is(item)) return false;
1491 if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length ])) return false; 1491 if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length ])) return false;
1492 let iterator = dart.dload(item, 'iterator'); 1492 let iterator = dart.dload(item, 'iterator');
1493 let i = 0; 1493 let i = 0;
1494 for (let e of this[_expected$]) { 1494 for (let e of this[_expected$]) {
1495 dart.dsend(iterator, 'moveNext'); 1495 dart.dsend(iterator, 'moveNext');
1496 if (!dart.test(dart.dcall(this[_comparator], e, dart.dload(iterator, 'cu rrent')))) { 1496 if (!dart.test(dart.dcall(this[_comparator], e, dart.dload(iterator, 'cu rrent')))) {
1497 src__util.addStateInfo(matchState, dart.map({index: i, expected: e, ac tual: dart.dload(iterator, 'current')})); 1497 src__util.addStateInfo(matchState, dart.map({index: i, expected: e, ac tual: dart.dload(iterator, 'current')}, core.String, dart.dynamic));
1498 return false; 1498 return false;
1499 } 1499 }
1500 i++; 1500 i++;
1501 } 1501 }
1502 return true; 1502 return true;
1503 } 1503 }
1504 describe(description) { 1504 describe(description) {
1505 return description.add(dart.str`pairwise ${this[_description$]} `).addDesc riptionOf(this[_expected$]); 1505 return description.add(dart.str`pairwise ${this[_description$]} `).addDesc riptionOf(this[_expected$]);
1506 } 1506 }
1507 describeMismatch(item, mismatchDescription, matchState, verbose) { 1507 describeMismatch(item, mismatchDescription, matchState, verbose) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 }); 1678 });
1679 const _matchers = Symbol('_matchers'); 1679 const _matchers = Symbol('_matchers');
1680 src__operator_matchers._AllOf = class _AllOf extends src__interfaces.Matcher { 1680 src__operator_matchers._AllOf = class _AllOf extends src__interfaces.Matcher {
1681 new(matchers) { 1681 new(matchers) {
1682 this[_matchers] = matchers; 1682 this[_matchers] = matchers;
1683 super.new(); 1683 super.new();
1684 } 1684 }
1685 matches(item, matchState) { 1685 matches(item, matchState) {
1686 for (let matcher of this[_matchers]) { 1686 for (let matcher of this[_matchers]) {
1687 if (!dart.test(matcher.matches(item, matchState))) { 1687 if (!dart.test(matcher.matches(item, matchState))) {
1688 src__util.addStateInfo(matchState, dart.map({matcher: matcher})); 1688 src__util.addStateInfo(matchState, dart.map({matcher: matcher}, core.S tring, src__interfaces.Matcher));
1689 return false; 1689 return false;
1690 } 1690 }
1691 } 1691 }
1692 return true; 1692 return true;
1693 } 1693 }
1694 describeMismatch(item, mismatchDescription, matchState, verbose) { 1694 describeMismatch(item, mismatchDescription, matchState, verbose) {
1695 let matcher = matchState[dartx.get]('matcher'); 1695 let matcher = matchState[dartx.get]('matcher');
1696 dart.dsend(matcher, 'describeMismatch', item, mismatchDescription, matchSt ate[dartx.get]('state'), verbose); 1696 dart.dsend(matcher, 'describeMismatch', item, mismatchDescription, matchSt ate[dartx.get]('state'), verbose);
1697 return mismatchDescription; 1697 return mismatchDescription;
1698 } 1698 }
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 methods: () => ({ 1974 methods: () => ({
1975 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), 1975 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]),
1976 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int erfaces.Description]) 1976 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int erfaces.Description])
1977 }) 1977 })
1978 }); 1978 });
1979 src__string_matchers._isWhitespace = function(ch) { 1979 src__string_matchers._isWhitespace = function(ch) {
1980 return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; 1980 return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
1981 }; 1981 };
1982 dart.fn(src__string_matchers._isWhitespace, StringTobool()); 1982 dart.fn(src__string_matchers._isWhitespace, StringTobool());
1983 src__util._Predicate = dart.typedef('_Predicate', () => dart.functionType(core .bool, [dart.dynamic])); 1983 src__util._Predicate = dart.typedef('_Predicate', () => dart.functionType(core .bool, [dart.dynamic]));
1984 src__util._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\ \f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'})); 1984 src__util._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\ \f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'}, core.String, core.Str ing));
1985 dart.defineLazy(src__util, { 1985 dart.defineLazy(src__util, {
1986 get _escapeRegExp() { 1986 get _escapeRegExp() {
1987 return core.RegExp.new(dart.str`[\\x00-\\x07\\x0E-\\x1F${src__util._escape Map[dartx.keys][dartx.map](core.String)(src__util._getHexLiteral)[dartx.join]()} ]`); 1987 return core.RegExp.new(dart.str`[\\x00-\\x07\\x0E-\\x1F${src__util._escape Map[dartx.keys][dartx.map](core.String)(src__util._getHexLiteral)[dartx.join]()} ]`);
1988 } 1988 }
1989 }); 1989 });
1990 src__util._getHexLiteral = function(input) { 1990 src__util._getHexLiteral = function(input) {
1991 let rune = input[dartx.runes].single; 1991 let rune = input[dartx.runes].single;
1992 return '\\x' + dart.notNull(rune[dartx.toRadixString](16)[dartx.toUpperCase] ()[dartx.padLeft](2, '0')); 1992 return '\\x' + dart.notNull(rune[dartx.toRadixString](16)[dartx.toUpperCase] ()[dartx.padLeft](2, '0'));
1993 }; 1993 };
1994 dart.fn(src__util._getHexLiteral, StringToString()); 1994 dart.fn(src__util._getHexLiteral, StringToString());
1995 // Exports: 1995 // Exports:
1996 exports.matcher = matcher; 1996 exports.matcher = matcher;
1997 exports.mirror_matchers = mirror_matchers; 1997 exports.mirror_matchers = mirror_matchers;
1998 exports.src__core_matchers = src__core_matchers; 1998 exports.src__core_matchers = src__core_matchers;
1999 exports.src__description = src__description; 1999 exports.src__description = src__description;
2000 exports.src__error_matchers = src__error_matchers; 2000 exports.src__error_matchers = src__error_matchers;
2001 exports.src__interfaces = src__interfaces; 2001 exports.src__interfaces = src__interfaces;
2002 exports.src__iterable_matchers = src__iterable_matchers; 2002 exports.src__iterable_matchers = src__iterable_matchers;
2003 exports.src__map_matchers = src__map_matchers; 2003 exports.src__map_matchers = src__map_matchers;
2004 exports.src__numeric_matchers = src__numeric_matchers; 2004 exports.src__numeric_matchers = src__numeric_matchers;
2005 exports.src__operator_matchers = src__operator_matchers; 2005 exports.src__operator_matchers = src__operator_matchers;
2006 exports.src__pretty_print = src__pretty_print; 2006 exports.src__pretty_print = src__pretty_print;
2007 exports.src__string_matchers = src__string_matchers; 2007 exports.src__string_matchers = src__string_matchers;
2008 exports.src__util = src__util; 2008 exports.src__util = src__util;
2009 }); 2009 });
OLDNEW
« no previous file with comments | « test/codegen_expected/map_keys.js ('k') | test/codegen_expected/stack_trace/stack_trace.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698