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

[JS] When building source maps getting p.getLineCount is not a function #2826

Closed
arichiardi opened this issue Feb 22, 2018 · 4 comments
Closed

Comments

@arichiardi
Copy link
Contributor

Hello Google folks!

First of all I am sorry if this is not the place for this bug report, it is concerning the JS port.
Note that I don't have a reproducible case with only the compiler, but I can make one in case it is needed.

When generating source maps using lumo, which uses google-closure-compiler-js, I get an error:

p.getLineCount is not a function
	 HJ (google-closure-compiler-js.cljs:7737:245)
	 l2c (google-closure-compiler-js.cljs:6713:84)
	 zHb (google-closure-compiler-js.cljs:5842:99)
	 P1c (google-closure-compiler-js.cljs:6145:152)
	 tDb (google-closure-compiler-js.cljs:5056:103)
	 iDb (google-closure-compiler-js.cljs:7117:315)
	 jDb (google-closure-compiler-js.cljs:5569:102)
	 yIb (google-closure-compiler-js.cljs:6208:201)
	 TIb (google-closure-compiler-js.cljs:7722:452)
	 (UIb.VIb)
	 jJb (google-closure-compiler-js.cljs:4846:36)
	 wIb (google-closure-compiler-js.cljs:1758:23)
	 NIb (google-closure-compiler-js.cljs:6165:148)
	 (OIb.PIb)
	 jJb (google-closure-compiler-js.cljs:4846:36)
	 sjd (google-closure-compiler-js.cljs:6538:35)
	 jjd (google-closure-compiler-js.cljs:7692:407)
	 hK (google-closure-compiler-js.cljs:1833:29)
	 kK (google-closure-compiler-js.cljs:3201:44)
	 (google-closure-compiler-js.cljs:3404:46)
	 compile (google-closure-compiler-js.cljs:8106:15)
	 Function.lumo.closure.optimize.cljs$core$IFn$_invoke$arity$variadic (evalmachine.<anonymous>:2623:123)
...

The steps are described here anmonteiro/lumo#361, but more importantly I was wondering whether the source map portion of the code is known to be stable.

Thanks a lot for your hard work!

@MatrixFrog
Copy link
Contributor

It looks like we need to write an implementation at https://github.com/google/closure-compiler/blob/master/src/com/google/debugging/sourcemap/SourceMapObjectParserJs.java#L60

I assume just return this.lineCount; will do.

@arichiardi
Copy link
Contributor Author

arichiardi commented Feb 25, 2018

So this might be a very noob question but I got a compiler error saying that a native method cannot have an implementation. Additionally, it seems that .getLineCount is used only there being a private class. I might be wrong but maybe the intent there was to get rid of it?

Line 94 can become:

    builder.setLineCount(sourceMap.lineCount);

I don't know what happens when JS properties are undefined, maybe a check is appropriate there.

What do you think @MatrixFrog?

@arichiardi
Copy link
Contributor Author

Just came across the syntax with */

Maybe:

    @JsMethod
    native Object getLineCount() /*-{ return this.lineCount; }-*/;

?

@arichiardi
Copy link
Contributor Author

I confirm the proposed PR solves the issue.

arichiardi added a commit to arichiardi/closure-compiler that referenced this issue Feb 25, 2018
…tion

It was missing but used in the no JVM version when building source maps.
The implementation just returns the value of the lineCount property.
arichiardi added a commit to arichiardi/closure-compiler that referenced this issue Feb 25, 2018
…tion

It was missing but used in the no JVM version when building source maps.
The implementation just returns the value of the lineCount property.
arichiardi added a commit to arichiardi/closure-compiler that referenced this issue Feb 25, 2018
…tion

It was missing but used in the no JVM version when building source maps.
The implementation just returns the value of the lineCount property.
sebasjm pushed a commit to sebasjm/closure-compiler that referenced this issue Mar 11, 2018
It was missing but used in the no JVM version when building source maps.
The implementation just returns the value of the lineCount property.

Fixes google#2826
Closes google#2829

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187063993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants