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

Wrong generated output from js.html.ScrollIntoViewOptions "_inline" field #10093

Closed
cambiata opened this issue Jan 28, 2021 · 2 comments
Closed

Comments

@cambiata
Copy link

The following code

import js.html.ScrollIntoViewOptions;
import js.html.ScrollLogicalPosition;
function main() {
	var testElement = document.createDivElement();
	testElement.scrollIntoView({
		_inline: ScrollLogicalPosition.CENTER  // <----- "_inline"
	});
}

...with the following typedef...

// This file is generated from mozilla\Element.webidl. Do not edit!
package js.html;

typedef ScrollIntoViewOptions = ScrollOptions & {
	var ?block:ScrollLogicalPosition;
	@:native("inline") //                <---
	var ?_inline:ScrollLogicalPosition;
}

...should - because of the @:native("inline") - generate a field with the name "inline", shouldn't it?

However, the generated code has the untransformed field name "_inline", witch of course does not work:

// Generated by Haxe 4.2.0-rc.1+2776f3cd4
(function ($global) {"use strict";
	function App_main() {
		var testElement = window.document.createElement("div");
		testElement.scrollIntoView({ _inline: "center" });   // <-------- should be "inline", not "_inline"
	}
});

It seems that the @:native("inline") isn't taken into account by the compiler?!

@kLabz
Copy link
Contributor

kLabz commented Jan 28, 2021

shouldn't it?

No, it doesn't work on typedef. There are several discussions about it, I'll try to find one.
Edit: this may be the main one #5105

@cambiata
Copy link
Author

Ah, thanks! Will try to implementera an abstract solution for now... Closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants