Skip to content

Commit

Permalink
Add option to suppress type-check whitelisting
Browse files Browse the repository at this point in the history
Run most tests without the whitelisting.

See #27223

R=leafp@google.com

Review-Url: https://codereview.chromium.org/2739863003 .
  • Loading branch information
vsmenon committed Mar 9, 2017
1 parent 8c10e4a commit da1f954
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 30 deletions.
17 changes: 13 additions & 4 deletions pkg/dev_compiler/lib/js/amd/dart_sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ define([], function() {
let dynamicAndStringAnddynamicTovoid = () => (dynamicAndStringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, dart.dynamic])))();
let FAndintToF = () => (FAndintToF = dart.constFn(dart.definiteFunctionType(F => [F, [F, core.int]])))();
let JSSyntaxRegExpTodynamic = () => (JSSyntaxRegExpTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_js_helper.JSSyntaxRegExp])))();
let ListToListOfString = () => (ListToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.List])))();
let JSSyntaxRegExpToint = () => (JSSyntaxRegExpToint = dart.constFn(dart.definiteFunctionType(core.int, [_js_helper.JSSyntaxRegExp])))();
let JSSyntaxRegExpAndStringAndintToMatch = () => (JSSyntaxRegExpAndStringAndintToMatch = dart.constFn(dart.definiteFunctionType(core.Match, [_js_helper.JSSyntaxRegExp, core.String, core.int])))();
let dynamicAnddynamicAnddynamicToint = () => (dynamicAnddynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic, dart.dynamic])))();
Expand Down Expand Up @@ -1865,6 +1866,9 @@ define([], function() {
dart.trapRuntimeErrors = function(flag) {
dart._trapRuntimeErrors = flag;
};
dart.ignoreWhitelistedErrors = function(flag) {
dart._ignoreWhitelistedErrors = flag;
};
dart.throwCastError = function(object, actual, type) {
var found = dart.typeName(actual);
var expected = dart.typeName(type);
Expand Down Expand Up @@ -2228,7 +2232,7 @@ define([], function() {
let result = dart.isSubtype(actual, type);
if (result || actual == dart.jsobject || actual == core.int && type == core.double) return true;
if (result === false) return false;
if (ignoreFromWhiteList == void 0) return result;
if (!dart._ignoreWhitelistedErrors || ignoreFromWhiteList == void 0) return result;
if (dart._ignoreTypeFailure(actual, type)) return true;
return result;
};
Expand Down Expand Up @@ -2971,6 +2975,7 @@ define([], function() {
dart._typeFormalCount = Symbol("_typeFormalCount");
dart.isSubtype = dart._subtypeMemo((t1, t2) => t1 === t2 || dart._isSubtype(t1, t2, true));
dart._trapRuntimeErrors = true;
dart._ignoreWhitelistedErrors = true;
dart._jsIterator = Symbol("_jsIterator");
dart._current = Symbol("_current");
dart._AsyncStarStreamController = class _AsyncStarStreamController {
Expand Down Expand Up @@ -12834,6 +12839,10 @@ define([], function() {
return regexp[_nativeRegExp];
};
dart.lazyFn(_js_helper.regExpGetNative, () => JSSyntaxRegExpTodynamic());
_js_helper._stringList = function(l) {
return ListOfString()._check(l == null ? l : dart.list(l, core.String));
};
dart.lazyFn(_js_helper._stringList, () => ListToListOfString());
const _nativeGlobalVersion = Symbol('_nativeGlobalVersion');
_js_helper.regExpGetGlobalNative = function(regexp) {
let nativeRegexp = regexp[_nativeGlobalVersion];
Expand Down Expand Up @@ -12900,7 +12909,7 @@ define([], function() {
firstMatch(string) {
let m = this[_nativeRegExp].exec(_js_helper.checkString(string));
if (m == null) return null;
return new _js_helper._MatchImplementation(this, m);
return new _js_helper._MatchImplementation(this, _js_helper._stringList(m));
}
hasMatch(string) {
return this[_nativeRegExp].test(_js_helper.checkString(string));
Expand All @@ -12924,7 +12933,7 @@ define([], function() {
regexp.lastIndex = start;
let match = regexp.exec(string);
if (match == null) return null;
return new _js_helper._MatchImplementation(this, ListOfString()._check(match));
return new _js_helper._MatchImplementation(this, _js_helper._stringList(match));
}
[_execAnchored](string, start) {
let regexp = this[_nativeAnchoredVersion];
Expand All @@ -12933,7 +12942,7 @@ define([], function() {
if (match == null) return null;
if (match[dartx._get](dart.notNull(match[dartx.length]) - 1) != null) return null;
match[dartx.length] = dart.notNull(match[dartx.length]) - 1;
return new _js_helper._MatchImplementation(this, ListOfString()._check(match));
return new _js_helper._MatchImplementation(this, _js_helper._stringList(match));
}
matchAsPrefix(string, start) {
if (start === void 0) start = 0;
Expand Down
17 changes: 13 additions & 4 deletions pkg/dev_compiler/lib/js/common/dart_sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@
let dynamicAndStringAnddynamicTovoid = () => (dynamicAndStringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, dart.dynamic])))();
let FAndintToF = () => (FAndintToF = dart.constFn(dart.definiteFunctionType(F => [F, [F, core.int]])))();
let JSSyntaxRegExpTodynamic = () => (JSSyntaxRegExpTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_js_helper.JSSyntaxRegExp])))();
let ListToListOfString = () => (ListToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.List])))();
let JSSyntaxRegExpToint = () => (JSSyntaxRegExpToint = dart.constFn(dart.definiteFunctionType(core.int, [_js_helper.JSSyntaxRegExp])))();
let JSSyntaxRegExpAndStringAndintToMatch = () => (JSSyntaxRegExpAndStringAndintToMatch = dart.constFn(dart.definiteFunctionType(core.Match, [_js_helper.JSSyntaxRegExp, core.String, core.int])))();
let dynamicAnddynamicAnddynamicToint = () => (dynamicAnddynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic, dart.dynamic])))();
Expand Down Expand Up @@ -1865,6 +1866,9 @@
dart.trapRuntimeErrors = function(flag) {
dart._trapRuntimeErrors = flag;
};
dart.ignoreWhitelistedErrors = function(flag) {
dart._ignoreWhitelistedErrors = flag;
};
dart.throwCastError = function(object, actual, type) {
var found = dart.typeName(actual);
var expected = dart.typeName(type);
Expand Down Expand Up @@ -2228,7 +2232,7 @@
let result = dart.isSubtype(actual, type);
if (result || actual == dart.jsobject || actual == core.int && type == core.double) return true;
if (result === false) return false;
if (ignoreFromWhiteList == void 0) return result;
if (!dart._ignoreWhitelistedErrors || ignoreFromWhiteList == void 0) return result;
if (dart._ignoreTypeFailure(actual, type)) return true;
return result;
};
Expand Down Expand Up @@ -2971,6 +2975,7 @@
dart._typeFormalCount = Symbol("_typeFormalCount");
dart.isSubtype = dart._subtypeMemo((t1, t2) => t1 === t2 || dart._isSubtype(t1, t2, true));
dart._trapRuntimeErrors = true;
dart._ignoreWhitelistedErrors = true;
dart._jsIterator = Symbol("_jsIterator");
dart._current = Symbol("_current");
dart._AsyncStarStreamController = class _AsyncStarStreamController {
Expand Down Expand Up @@ -12834,6 +12839,10 @@
return regexp[_nativeRegExp];
};
dart.lazyFn(_js_helper.regExpGetNative, () => JSSyntaxRegExpTodynamic());
_js_helper._stringList = function(l) {
return ListOfString()._check(l == null ? l : dart.list(l, core.String));
};
dart.lazyFn(_js_helper._stringList, () => ListToListOfString());
const _nativeGlobalVersion = Symbol('_nativeGlobalVersion');
_js_helper.regExpGetGlobalNative = function(regexp) {
let nativeRegexp = regexp[_nativeGlobalVersion];
Expand Down Expand Up @@ -12900,7 +12909,7 @@
firstMatch(string) {
let m = this[_nativeRegExp].exec(_js_helper.checkString(string));
if (m == null) return null;
return new _js_helper._MatchImplementation(this, m);
return new _js_helper._MatchImplementation(this, _js_helper._stringList(m));
}
hasMatch(string) {
return this[_nativeRegExp].test(_js_helper.checkString(string));
Expand All @@ -12924,7 +12933,7 @@
regexp.lastIndex = start;
let match = regexp.exec(string);
if (match == null) return null;
return new _js_helper._MatchImplementation(this, ListOfString()._check(match));
return new _js_helper._MatchImplementation(this, _js_helper._stringList(match));
}
[_execAnchored](string, start) {
let regexp = this[_nativeAnchoredVersion];
Expand All @@ -12933,7 +12942,7 @@
if (match == null) return null;
if (match[dartx._get](dart.notNull(match[dartx.length]) - 1) != null) return null;
match[dartx.length] = dart.notNull(match[dartx.length]) - 1;
return new _js_helper._MatchImplementation(this, ListOfString()._check(match));
return new _js_helper._MatchImplementation(this, _js_helper._stringList(match));
}
matchAsPrefix(string, start) {
if (start === void 0) start = 0;
Expand Down
17 changes: 13 additions & 4 deletions pkg/dev_compiler/lib/js/es6/dart_sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ let dynamicAndStringTodynamic = () => (dynamicAndStringTodynamic = dart.constFn(
let dynamicAndStringAnddynamicTovoid = () => (dynamicAndStringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, dart.dynamic])))();
let FAndintToF = () => (FAndintToF = dart.constFn(dart.definiteFunctionType(F => [F, [F, core.int]])))();
let JSSyntaxRegExpTodynamic = () => (JSSyntaxRegExpTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_js_helper.JSSyntaxRegExp])))();
let ListToListOfString = () => (ListToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.List])))();
let JSSyntaxRegExpToint = () => (JSSyntaxRegExpToint = dart.constFn(dart.definiteFunctionType(core.int, [_js_helper.JSSyntaxRegExp])))();
let JSSyntaxRegExpAndStringAndintToMatch = () => (JSSyntaxRegExpAndStringAndintToMatch = dart.constFn(dart.definiteFunctionType(core.Match, [_js_helper.JSSyntaxRegExp, core.String, core.int])))();
let dynamicAnddynamicAnddynamicToint = () => (dynamicAnddynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic, dart.dynamic])))();
Expand Down Expand Up @@ -1863,6 +1864,9 @@ dart.isGroundType = function(type) {
dart.trapRuntimeErrors = function(flag) {
dart._trapRuntimeErrors = flag;
};
dart.ignoreWhitelistedErrors = function(flag) {
dart._ignoreWhitelistedErrors = flag;
};
dart.throwCastError = function(object, actual, type) {
var found = dart.typeName(actual);
var expected = dart.typeName(type);
Expand Down Expand Up @@ -2226,7 +2230,7 @@ dart.strongInstanceOf = function(obj, type, ignoreFromWhiteList) {
let result = dart.isSubtype(actual, type);
if (result || actual == dart.jsobject || actual == core.int && type == core.double) return true;
if (result === false) return false;
if (ignoreFromWhiteList == void 0) return result;
if (!dart._ignoreWhitelistedErrors || ignoreFromWhiteList == void 0) return result;
if (dart._ignoreTypeFailure(actual, type)) return true;
return result;
};
Expand Down Expand Up @@ -2969,6 +2973,7 @@ dart.setSignature(dart.Typedef, {
dart._typeFormalCount = Symbol("_typeFormalCount");
dart.isSubtype = dart._subtypeMemo((t1, t2) => t1 === t2 || dart._isSubtype(t1, t2, true));
dart._trapRuntimeErrors = true;
dart._ignoreWhitelistedErrors = true;
dart._jsIterator = Symbol("_jsIterator");
dart._current = Symbol("_current");
dart._AsyncStarStreamController = class _AsyncStarStreamController {
Expand Down Expand Up @@ -12832,6 +12837,10 @@ _js_helper.regExpGetNative = function(regexp) {
return regexp[_nativeRegExp];
};
dart.lazyFn(_js_helper.regExpGetNative, () => JSSyntaxRegExpTodynamic());
_js_helper._stringList = function(l) {
return ListOfString()._check(l == null ? l : dart.list(l, core.String));
};
dart.lazyFn(_js_helper._stringList, () => ListToListOfString());
const _nativeGlobalVersion = Symbol('_nativeGlobalVersion');
_js_helper.regExpGetGlobalNative = function(regexp) {
let nativeRegexp = regexp[_nativeGlobalVersion];
Expand Down Expand Up @@ -12898,7 +12907,7 @@ _js_helper.JSSyntaxRegExp = class JSSyntaxRegExp extends core.Object {
firstMatch(string) {
let m = this[_nativeRegExp].exec(_js_helper.checkString(string));
if (m == null) return null;
return new _js_helper._MatchImplementation(this, m);
return new _js_helper._MatchImplementation(this, _js_helper._stringList(m));
}
hasMatch(string) {
return this[_nativeRegExp].test(_js_helper.checkString(string));
Expand All @@ -12922,7 +12931,7 @@ _js_helper.JSSyntaxRegExp = class JSSyntaxRegExp extends core.Object {
regexp.lastIndex = start;
let match = regexp.exec(string);
if (match == null) return null;
return new _js_helper._MatchImplementation(this, ListOfString()._check(match));
return new _js_helper._MatchImplementation(this, _js_helper._stringList(match));
}
[_execAnchored](string, start) {
let regexp = this[_nativeAnchoredVersion];
Expand All @@ -12931,7 +12940,7 @@ _js_helper.JSSyntaxRegExp = class JSSyntaxRegExp extends core.Object {
if (match == null) return null;
if (match[dartx._get](dart.notNull(match[dartx.length]) - 1) != null) return null;
match[dartx.length] = dart.notNull(match[dartx.length]) - 1;
return new _js_helper._MatchImplementation(this, ListOfString()._check(match));
return new _js_helper._MatchImplementation(this, _js_helper._stringList(match));
}
matchAsPrefix(string, start) {
if (start === void 0) start = 0;
Expand Down
17 changes: 13 additions & 4 deletions pkg/dev_compiler/lib/js/legacy/dart_sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
let dynamicAndStringAnddynamicTovoid = () => (dynamicAndStringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, dart.dynamic])))();
let FAndintToF = () => (FAndintToF = dart.constFn(dart.definiteFunctionType(F => [F, [F, core.int]])))();
let JSSyntaxRegExpTodynamic = () => (JSSyntaxRegExpTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_js_helper.JSSyntaxRegExp])))();
let ListToListOfString = () => (ListToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.List])))();
let JSSyntaxRegExpToint = () => (JSSyntaxRegExpToint = dart.constFn(dart.definiteFunctionType(core.int, [_js_helper.JSSyntaxRegExp])))();
let JSSyntaxRegExpAndStringAndintToMatch = () => (JSSyntaxRegExpAndStringAndintToMatch = dart.constFn(dart.definiteFunctionType(core.Match, [_js_helper.JSSyntaxRegExp, core.String, core.int])))();
let dynamicAnddynamicAnddynamicToint = () => (dynamicAnddynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic, dart.dynamic])))();
Expand Down Expand Up @@ -1866,6 +1867,9 @@ dart_library.library('dart_sdk', null, /* Imports */[
dart.trapRuntimeErrors = function(flag) {
dart._trapRuntimeErrors = flag;
};
dart.ignoreWhitelistedErrors = function(flag) {
dart._ignoreWhitelistedErrors = flag;
};
dart.throwCastError = function(object, actual, type) {
var found = dart.typeName(actual);
var expected = dart.typeName(type);
Expand Down Expand Up @@ -2229,7 +2233,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
let result = dart.isSubtype(actual, type);
if (result || actual == dart.jsobject || actual == core.int && type == core.double) return true;
if (result === false) return false;
if (ignoreFromWhiteList == void 0) return result;
if (!dart._ignoreWhitelistedErrors || ignoreFromWhiteList == void 0) return result;
if (dart._ignoreTypeFailure(actual, type)) return true;
return result;
};
Expand Down Expand Up @@ -2972,6 +2976,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
dart._typeFormalCount = Symbol("_typeFormalCount");
dart.isSubtype = dart._subtypeMemo((t1, t2) => t1 === t2 || dart._isSubtype(t1, t2, true));
dart._trapRuntimeErrors = true;
dart._ignoreWhitelistedErrors = true;
dart._jsIterator = Symbol("_jsIterator");
dart._current = Symbol("_current");
dart._AsyncStarStreamController = class _AsyncStarStreamController {
Expand Down Expand Up @@ -12835,6 +12840,10 @@ dart_library.library('dart_sdk', null, /* Imports */[
return regexp[_nativeRegExp];
};
dart.lazyFn(_js_helper.regExpGetNative, () => JSSyntaxRegExpTodynamic());
_js_helper._stringList = function(l) {
return ListOfString()._check(l == null ? l : dart.list(l, core.String));
};
dart.lazyFn(_js_helper._stringList, () => ListToListOfString());
const _nativeGlobalVersion = Symbol('_nativeGlobalVersion');
_js_helper.regExpGetGlobalNative = function(regexp) {
let nativeRegexp = regexp[_nativeGlobalVersion];
Expand Down Expand Up @@ -12901,7 +12910,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
firstMatch(string) {
let m = this[_nativeRegExp].exec(_js_helper.checkString(string));
if (m == null) return null;
return new _js_helper._MatchImplementation(this, m);
return new _js_helper._MatchImplementation(this, _js_helper._stringList(m));
}
hasMatch(string) {
return this[_nativeRegExp].test(_js_helper.checkString(string));
Expand All @@ -12925,7 +12934,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
regexp.lastIndex = start;
let match = regexp.exec(string);
if (match == null) return null;
return new _js_helper._MatchImplementation(this, ListOfString()._check(match));
return new _js_helper._MatchImplementation(this, _js_helper._stringList(match));
}
[_execAnchored](string, start) {
let regexp = this[_nativeAnchoredVersion];
Expand All @@ -12934,7 +12943,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
if (match == null) return null;
if (match[dartx._get](dart.notNull(match[dartx.length]) - 1) != null) return null;
match[dartx.length] = dart.notNull(match[dartx.length]) - 1;
return new _js_helper._MatchImplementation(this, ListOfString()._check(match));
return new _js_helper._MatchImplementation(this, _js_helper._stringList(match));
}
matchAsPrefix(string, start) {
if (start === void 0) start = 0;
Expand Down
Binary file modified pkg/dev_compiler/lib/sdk/ddc_sdk.sum
Binary file not shown.
Loading

0 comments on commit da1f954

Please sign in to comment.