clutz icon indicating copy to clipboard operation
clutz copied to clipboard

Static members on function not emitted

Open Eyas opened this issue 6 years ago • 0 comments

I tried this twice, with goog.provide and goog.module, with similar results:

Actual

Using Provide

goog.provide('lib.my');

/**
 * @param {string} data
 */
lib.my.resemble = function(data) {};

/** @returns {string} data */
lib.my.resemble.staticOne = function(data) {};

/**
 * @const
 * @type {function(string)}
 */
lib.my.resemble.staticTwo = function(data) {};

Processing that using:

clutz_release.jar ./test.js

produces

declare namespace ಠ_ಠ.clutz.lib.my {
  function resemble (data : string ) : void ;
}
declare module 'goog:lib.my' {
  import my = ಠ_ಠ.clutz.lib.my;
  export = my;
}

Using Module

goog.module('lib.my');

/**
 * @param {string} data
 */
var resemble = function(data) {};

/** @returns {string} data */
resemble.staticOne = function(data) {};

/**
 * @const
 * @type {function(string)}
 */
resemble.staticTwo = function(data) {};

exports.resemble = resemble;

Outputs:

declare namespace ಠ_ಠ.clutz.module$exports$lib$my {
  function resemble (data : string ) : void ;
}
declare module 'goog:lib.my' {
  import my = ಠ_ಠ.clutz.module$exports$lib$my;
  export = my;
}

Expected

declare namespace ಠ_ಠ.clutz.module$exports$lib$my {
  namespace resemble {
    function staticOne (data : any ) : string ;
    function staticTwo (a : string ) : any ;
  }
  function resemble (data : string ) : void ;
}
declare module 'goog:lib.my' {
  import my = ಠ_ಠ.clutz.module$exports$lib$my;
  export = my;
}

Eyas avatar Apr 26 '19 14:04 Eyas