Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dgeni fails to process function declarations #2446

Closed
mhevery opened this issue Jun 9, 2015 · 10 comments
Closed

dgeni fails to process function declarations #2446

mhevery opened this issue Jun 9, 2015 · 10 comments

Comments

@mhevery
Copy link
Contributor

mhevery commented Jun 9, 2015

failure

12:03 $ gulp docs/dgeni
Dart SDK detected
[12:04:02] Using gulpfile ~/work/angular/gulpfile.js
[12:04:02] Starting 'docs/dgeni'...
warn:    No module code found in angular2/di_annotations.ts
warn:    No module code found in angular2/di_errors.ts
warn:    No module code found in angular2/globals.d.ts
warn:    No module code found in angular2/traceur-runtime.d.ts
warn:    No module code found in angular2/view.ts
warn:    No module code found in benchpress/index.ts
warn:    No module code found in angular2/src/test_lib/shims_for_IE.ts
warn:    No module code found in benchpress/src/firefox_extension/data/installed_script.ts
warn:    No module code found in benchpress/src/firefox_extension/lib/main.ts
warn:    No module code found in benchpress/src/firefox_extension/lib/test_helper.ts
error:   ReferenceError: log is not defined
    at /Users/misko/work/angular/docs/dgeni-package/services/tsParser/getExportDocType.js:31:5
    at createExportDoc (/Users/misko/work/angular/docs/dgeni-package/processors/readTypeScriptModules.js:143:16)
    at /Users/misko/work/angular/docs/dgeni-package/processors/readTypeScriptModules.js:63:27
    at Array.forEach (native)
    at /Users/misko/work/angular/docs/dgeni-package/processors/readTypeScriptModules.js:56:34
    at Array.forEach (native)
    at Object.$process (/Users/misko/work/angular/docs/dgeni-package/processors/readTypeScriptModules.js:47:21)
    at /Users/misko/work/angular/node_modules/dgeni/lib/Dgeni.js:202:28
    at _fulfilled (/Users/misko/work/angular/node_modules/dgeni/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/Users/misko/work/angular/node_modules/dgeni/node_modules/q/q.js:827:30)
error:   Error processing docs: 
[12:04:05] 'docs/dgeni' errored after 3.04 s
[12:04:05] ReferenceError: log is not defined
    at /Users/misko/work/angular/docs/dgeni-package/services/tsParser/getExportDocType.js:31:5
    at createExportDoc (/Users/misko/work/angular/docs/dgeni-package/processors/readTypeScriptModules.js:143:16)
    at /Users/misko/work/angular/docs/dgeni-package/processors/readTypeScriptModules.js:63:27
    at Array.forEach (native)
    at /Users/misko/work/angular/docs/dgeni-package/processors/readTypeScriptModules.js:56:34
    at Array.forEach (native)
    at Object.$process (/Users/misko/work/angular/docs/dgeni-package/processors/readTypeScriptModules.js:47:21)
    at /Users/misko/work/angular/node_modules/dgeni/lib/Dgeni.js:202:28
    at _fulfilled (/Users/misko/work/angular/node_modules/dgeni/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/Users/misko/work/angular/node_modules/dgeni/node_modules/q/q.js:827:30)

cause:

https://github.com/angular/angular/blob/master/modules/angular2/src/reflection/types.ts

import {Type} from 'angular2/src/facade/lang';
import {List} from 'angular2/src/facade/collection';

export {Function as GetterFn};  // THIS WORKS
export {Function as SetterFn};
export {Function as MethodFn};

// TODO replace once dgeni is fixed
/**
export type SetterFn = (obj: any, value: any) => void; // THIS FAILS
export type GetterFn = (obj: any) => any;
export type MethodFn = (obj: any, args: List<any>) => any;
**/
@petebacondarwin
Copy link
Member

I have fixed the initial error (i.e. the log is not defined). The log service had not been injected into this service.

@petebacondarwin
Copy link
Member

I have also added the missing symbol type to the getExportTypes service: f2e2ce1

@petebacondarwin
Copy link
Member

@mhevery this is now fixed so you can go ahead and update the syntax.

@yjbanov
Copy link
Contributor

yjbanov commented Jun 25, 2015

Should this issue be closed?

@petebacondarwin
Copy link
Member

I am happy to close this but I left it open as a reminder to @mhevery that he could go and update the code the code that had been triggering the bug to be noticed. I.E. this style of declaration:

export type SetterFn = (obj: any, value: any) => void;
export type GetterFn = (obj: any) => any;
export type MethodFn = (obj: any, args: List<any>) => any;

@vicb
Copy link
Contributor

vicb commented Jun 26, 2015

I think the current/new way to express this is:

export interface SetterFn {
  (obj: any, value: any) => void;
}

is this right @yjbanov ? is this in our current version of ts2dart ?

@yjbanov
Copy link
Contributor

yjbanov commented Jun 26, 2015

@alexeagle will shortly release a new version of ts2dart that will support interface-based function types.

@naomiblack naomiblack modified the milestones: alpha-30, alpha-28 Jun 30, 2015
@naomiblack naomiblack assigned alexeagle and unassigned mhevery Jun 30, 2015
@naomiblack
Copy link
Contributor

Chatted with @alexeagle. He'll own this one, seems straightforward to complete once ts2dart is updated.

@alexeagle
Copy link
Contributor

that file is shadowed by types.dart so it isn't transpiled by ts2dart. We can just revert the dgeni workaround.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants