From eef87fdaac6898af8bb66d51b8fb5b7706b0578f Mon Sep 17 00:00:00 2001 From: Erik Timmers Date: Tue, 26 Aug 2014 08:15:02 +0200 Subject: [PATCH] Fix potentially exceeding call stack limit Fixes #2590. Improves parsing time. --- src/ol/format/wktformat.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ol/format/wktformat.js b/src/ol/format/wktformat.js index 328e95537a..b90b683429 100644 --- a/src/ol/format/wktformat.js +++ b/src/ol/format/wktformat.js @@ -761,8 +761,8 @@ ol.format.WKT.Parser.prototype.parsePoint_ = function() { */ ol.format.WKT.Parser.prototype.parsePointList_ = function() { var coordinates = [this.parsePoint_()]; - if (this.match(ol.format.WKT.TokenType.COMMA)) { - goog.array.extend(coordinates, this.parsePointList_()); + while (this.match(ol.format.WKT.TokenType.COMMA)) { + coordinates.push(this.parsePoint_()); } return coordinates; }; @@ -774,8 +774,8 @@ ol.format.WKT.Parser.prototype.parsePointList_ = function() { */ ol.format.WKT.Parser.prototype.parsePointTextList_ = function() { var coordinates = [this.parsePointText_()]; - if (this.match(ol.format.WKT.TokenType.COMMA)) { - goog.array.extend(coordinates, this.parsePointTextList_()); + while (this.match(ol.format.WKT.TokenType.COMMA)) { + coordinates.push(this.parsePointText_()); } return coordinates; }; @@ -787,8 +787,8 @@ ol.format.WKT.Parser.prototype.parsePointTextList_ = function() { */ ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() { var coordinates = [this.parseLineStringText_()]; - if (this.match(ol.format.WKT.TokenType.COMMA)) { - goog.array.extend(coordinates, this.parseLineStringTextList_()); + while (this.match(ol.format.WKT.TokenType.COMMA)) { + coordinates.push(this.parseLineStringText_()); } return coordinates; }; @@ -800,8 +800,8 @@ ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() { */ ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() { var coordinates = [this.parsePolygonText_()]; - if (this.match(ol.format.WKT.TokenType.COMMA)) { - goog.array.extend(coordinates, this.parsePolygonTextList_()); + while (this.match(ol.format.WKT.TokenType.COMMA)) { + coordinates.push(this.parsePolygonText_()); } return coordinates; };