JS: Remove fake JSONType from es5.js externs

This commit is contained in:
Asger F
2019-08-07 10:20:32 +01:00
parent e7166c2a1c
commit cfa2ec1084
2 changed files with 2 additions and 21 deletions

View File

@@ -236,20 +236,13 @@ Date.prototype.toISOString = function() {};
Date.prototype.toJSON = function(opt_ignoredKey) {};
/**
* A fake type to model the JSON object.
* @constructor
*/
function JSONType() {}
/**
* @param {string} jsonStr The string to parse.
* @param {(function(string, *) : *)=} opt_reviver
* @return {*} The JSON object.
* @throws {Error}
*/
JSONType.prototype.parse = function(jsonStr, opt_reviver) {};
JSON.parse = function(jsonStr, opt_reviver) {};
/**
@@ -259,11 +252,4 @@ JSONType.prototype.parse = function(jsonStr, opt_reviver) {};
* @return {string} JSON string which represents jsonObj.
* @throws {Error}
*/
JSONType.prototype.stringify = function(jsonObj, opt_replacer, opt_space) {};
/**
* @type {!JSONType}
* @suppress {duplicate}
*/
var JSON;
JSON.stringify = function(jsonObj, opt_replacer, opt_space) {};

View File

@@ -116,11 +116,6 @@ module GlobalAccessPath {
// Note: Avoid unneeded materialization of DataFlow::Node.getFile()
rhs.getAstNode().getFile() = file
)
or
// Hard-code JSON methods from the externs file, since they aren't explicitly assigned.
(accessPath = "JSON.parse" or accessPath = "JSON.stringify") and
file.getBaseName() = "es5.js" and
any(TopLevel tl | tl.getFile() = file).isExterns()
}
/**