Skip to content

Commit

Permalink
[FIX] Warning log of duplicate module declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
devtomtom committed Feb 28, 2019
1 parent 6a42786 commit 9a790a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/lbt/analyzer/JSModuleAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class JSModuleAnalyzer {
*/
} else if ( nModuleDeclarations > 1 && name === info.name ) {
// ignore duplicate declarations (e.g. in behavior file of design time controls)
log.warn("duplicate declaration of module name at %s", getLocation(args));
log.warn(`duplicate declaration of module ${getLocation(args)} in ${name}`);
} else {
// otherwise it is just a submodule declaration
info.addSubModule(name);
Expand Down
5 changes: 3 additions & 2 deletions lib/lbt/utils/ASTUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ module.exports = {
isMethodCall,
isNamedObject,
isIdentifier,
getLocation: function() {
return ""; // NODE-TODO
getLocation: function(args) {
// NODE-TODO include line information in future
return args[0].value;
},
getPropertyKey,
findOwnProperty,
Expand Down
2 changes: 1 addition & 1 deletion test/lib/lbt/utils/ASTUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ test("getStringArray", (t) => {
});

test("getLocation", (t) => {
t.deepEqual(ASTUtils.getLocation(), "");
t.deepEqual(ASTUtils.getLocation([{value: "module/name"}]), "module/name");
});

test("getPropertyKey", (t) => {
Expand Down

0 comments on commit 9a790a3

Please sign in to comment.