Skip to content

Commit 80e91d5

Browse files
committed
Fixed bug with new CSA. Preparing for final merge into master.
1 parent 60ee1bf commit 80e91d5

6 files changed

Lines changed: 35 additions & 59 deletions

File tree

Gruntfile.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,5 @@ module.exports = (grunt) ->
115115
grunt.registerTask 'build-scripting', ['clean:scripting','concat:scripting', 'copy:scripting', 'typescript']
116116
grunt.registerTask 'build-core', ['concat:core_only', 'autoprefixer', 'cssmin', 'uglify:core_only']
117117
grunt.registerTask 'build', ['concat:all', 'autoprefixer', 'cssmin', 'uglify:all']
118-
grunt.registerTask 'default', ['clean', 'build', 'watch']
118+
grunt.registerTask 'default', ['clean', 'build', 'build-scripting', 'watch']
119119

build/CommentCoreLibrary.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,11 @@ var CommentSpaceAllocator = (function () {
111111
}
112112
var pool = this._pools[cindex];
113113
if (pool.length === 0) {
114-
pool.push(comment);
115114
comment.cindex = cindex;
116115
return 0;
117116
} else if (this.pathCheck(0, comment, pool)) {
118117
// Has a path in the current pool
119118
comment.cindex = cindex;
120-
pool.binsert(comment, function (a, b) {
121-
if (a.bottom < b.bottom) {
122-
return -1;
123-
} else if (a.bottom === b.bottom) {
124-
return 0;
125-
} else {
126-
return 1;
127-
}
128-
});
129119
return 0;
130120
}
131121
var y = 0;
@@ -137,15 +127,6 @@ var CommentSpaceAllocator = (function () {
137127
if (this.pathCheck(y, comment, pool)) {
138128
// Has a path in the current pool
139129
comment.cindex = cindex;
140-
pool.binsert(comment, function (a, b) {
141-
if (a.bottom < b.bottom) {
142-
return -1;
143-
} else if (a.bottom === b.bottom) {
144-
return 0;
145-
} else {
146-
return 1;
147-
}
148-
});
149130
return y;
150131
}
151132
}
@@ -166,6 +147,15 @@ var CommentSpaceAllocator = (function () {
166147
comment.y = 0;
167148
} else {
168149
comment.y = this.assign(comment, 0);
150+
this._pools[comment.cindex].binsert(comment, function (a, b) {
151+
if (a.bottom < b.bottom) {
152+
return -1;
153+
} else if (a.bottom > b.bottom) {
154+
return 1;
155+
} else {
156+
return 0;
157+
}
158+
});
169159
}
170160
};
171161

@@ -178,6 +168,9 @@ var CommentSpaceAllocator = (function () {
178168
if (comment.cindex < 0) {
179169
return;
180170
}
171+
if (comment.cindex >= this._pools.length) {
172+
throw new Error("cindex out of bounds");
173+
}
181174
var index = this._pools[comment.cindex].indexOf(comment);
182175
if (index < 0)
183176
return;

0 commit comments

Comments
 (0)