(defineCall)
| 563 | } |
| 564 | |
| 565 | function onDefine(defineCall) { |
| 566 | const args = defineCall.arguments; |
| 567 | const nArgs = args.length; |
| 568 | let i = 0; |
| 569 | |
| 570 | // get the documentation from a preceding comment |
| 571 | const desc = getDocumentation(defineCall); |
| 572 | |
| 573 | // determine the name of the module |
| 574 | let name = null; |
| 575 | if ( i < nArgs ) { |
| 576 | const value = getStringValue( args[i] ); |
| 577 | if ( value !== undefined ) { |
| 578 | name = fromRequireJSName(value); |
| 579 | if ( name === defaultName ) { |
| 580 | // hardcoded name equals the file name, so this definition qualifies as main module definition |
| 581 | setMainModuleInfo(name, desc); |
| 582 | } else { |
| 583 | info.addSubModule(name); |
| 584 | if ( candidateName == null ) { |
| 585 | // remember the name and description in case no other module qualifies as main module |
| 586 | candidateName = name; |
| 587 | candidateDescription = desc; |
| 588 | } |
| 589 | } |
| 590 | i++; |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | if ( !name ) { |
| 595 | nUnnamedDefines++; |
| 596 | if ( nUnnamedDefines > 1 ) { |
| 597 | throw new Error( |
| 598 | "If multiple modules are contained in a file, only one of them may omit the module ID " + |
| 599 | name + " " + nUnnamedDefines); |
| 600 | } |
| 601 | if ( defaultName == null ) { |
| 602 | throw new Error("Unnamed module found, but no default name given"); |
| 603 | } |
| 604 | name = defaultName; |
| 605 | // the first unnamed module definition qualifies as main module |
| 606 | setMainModuleInfo(name, desc); |
| 607 | } |
| 608 | |
| 609 | // process array of required modules, if given |
| 610 | if ( i < nArgs && args[i].type === Syntax.ArrayExpression ) { |
| 611 | analyzeDependencyArray(args[i].elements, false, name); // TODO not always false, depends on context? |
| 612 | i++; |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | function onJQuerySapRequire(requireCall, conditional) { |
| 617 | const args = requireCall.arguments; |
nothing calls this directly
no test coverage detected