MCPcopy Create free account
hub / github.com/SAP/ui5-builder / onDeclare

Method onDeclare

lib/lbt/analyzer/JSModuleAnalyzer.js:538–563  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

536 }
537
538 function onDeclare(node) {
539 const args = node.arguments;
540 if (args.length > 0) {
541 const value = getStringValue(args[0]);
542 if (value !== undefined) {
543 const name = fromUI5LegacyName(value);
544 if ( nModuleDeclarations === 1 && !mainModuleFound) {
545 // if this is the first declaration, then this is the main module declaration
546 // note that this overrides an already given name
547 setMainModuleInfo(name, getDocumentation(node));
548 } else if ( nModuleDeclarations > 1 && name === info.name ) {
549 // ignore duplicate declarations (e.g. in behavior file of design time controls)
550 log.warn(`Duplicate declaration of module name at ${getLocation(args)} in ${name}`);
551 } else {
552 // otherwise it is just a submodule declaration
553 info.addSubModule(name);
554 }
555 return;
556 } else {
557 log.error(
558 `jQuery.sap.declare: Module name could not be determined from first argument: ${args[0]}`);
559 }
560 } else {
561 log.error("jQuery.sap.declare: Module name could not be determined, no arguments are given");
562 }
563 }
564
565 function onDefine(defineCall) {
566 const args = defineCall.arguments;

Callers

nothing calls this directly

Calls 5

getStringValueFunction · 0.90
fromUI5LegacyNameFunction · 0.90
getLocationFunction · 0.90
getDocumentationFunction · 0.85
addSubModuleMethod · 0.80

Tested by

no test coverage detected