-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INTERNAL] JSModuleAnalyzer: update language metadata (#44)
The JSModuleAnalyzer internally uses some metadata that describes for each ESTree node type, which properties represent conditionally executed code branches and which properties represent unconditionally executed code branches. The metadata is used while visiting an AST to classify dependencies as 'static' ord 'conditional'. During the migration of the analyzer from Java to JavaScript, metadata was only maintained for a rudimentary set of nodes (basically ES5) and all other nodes have been marked as 'toBeDone'. This change closes this gap and maintaines metadata for all ES6 node types. Only the node types planned for ES7 are kept as 'toBeDone'.
- Loading branch information
1 parent
712dcff
commit 05d4127
Showing
3 changed files
with
154 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
sap.ui.define([ | ||
'static/module1' | ||
], (m1) => { // using an arrow function for the module factory | ||
|
||
sap.ui.require(['static/module2'], function() { | ||
sap.ui.require(['static/module3'], function() {}); | ||
sap.ui.require('no-dependency/module1'); // probing API does not introduce a dependency | ||
}); | ||
|
||
// using an arrow function for the require callback | ||
sap.ui.require([], () => { | ||
sap.ui.require(['static/module4'], function() { | ||
}); | ||
}); | ||
|
||
// default value in array destructuring | ||
let [exp1 = sap.ui.require(['conditional/module1'], function(){})] = []; | ||
|
||
// default value in object destructuring | ||
let {exp2 = sap.ui.require(['conditional/module2'], function(){})} = {}; | ||
|
||
// dependency embedded in a template | ||
let exp3 = `Some text with an embedded dependency ${sap.ui.require(['static/module5'], function(){})} and further text`; | ||
|
||
// dependency embedded in a tagged template | ||
let exp4 = html`Some text with an embedded dependency ${sap.ui.require(['static/module6'], function(){})} and further text`; | ||
|
||
// IIAFE (an immediately invoked arrow function expression) | ||
((() => { | ||
sap.ui.require(['static/module7'], function(){}); | ||
})()); | ||
|
||
// a not immediately executed arrow function | ||
let helper = (() => { | ||
sap.ui.require(['conditional/module3'], function(){}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters