Permalink
Browse files

Fail on name clash instead of warning

  • Loading branch information...
ixti committed Jun 28, 2012
1 parent dc62fd7 commit a97f501f67e091cbdea37da4c251dbbfbe15b44b
View
@@ -69,6 +69,8 @@ function parse_files(files, options, callback) {
console.info('Parsing file: ' + file);
fn(file, options, function (err, file_nodes) {
+ // TODO: fail on name clash here as well -- as we might get name clash
+ // from different parsers, or even differnret files
_.extend(nodes, file_nodes);
next_file(err);
});
@@ -42,7 +42,12 @@ function parse_javascript(file, options, callback) {
// TODO: consider amending failing document inplace.
// Say, if it doesn't parse, insert a fake '*' line at failing `line` and retry
- nodes = parser.parse(source);
+ try {
+ nodes = parser.parse(source);
+ } catch (err) {
+ callback(err);
+ return;
+ }
// do pre-distribute early work
_.each(nodes, function (node, id) {
@@ -32,7 +32,7 @@ case 3:
x.line = ($$[$0-1].line + 1);
// register
if (this.$[x.id]) {
- console.error('name clash: ' + x.id);
+ throw new Error('name clash: ' + x.id);
}
this.$[x.id] = x;
// FIXME: remove once tree is build ok
View
@@ -118,7 +118,7 @@ world
x.line = ($5.line + 1);
// register
if ($$[x.id]) {
- console.error('name clash: ' + x.id);
+ throw new Error('name clash: ' + x.id);
}
$$[x.id] = x;
// FIXME: remove once tree is build ok
@@ -1261,7 +1261,7 @@
stopObserving: stopObserving.methodize(),
/**
- * Element.on(@element, eventName[, selector], callback) -> Event.Handler
+ * document.on(@element, eventName[, selector], callback) -> Event.Handler
*
* See [[Event.on]].
**/

0 comments on commit a97f501

Please sign in to comment.