Skip to content

Add support for abstract classes #48

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

Merged
merged 2 commits into from
Dec 7, 2017
Merged

Conversation

sbrunk
Copy link
Contributor

@sbrunk sbrunk commented Oct 18, 2017

Including abstract fields and methods.

Copy link
Owner

@sjrd sjrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Only a few nitpicks.

@@ -297,7 +297,8 @@ class TSDefParser extends StdTokenParsers with ImplicitConversions {
| "public" ^^^ Modifier.Public
| "readonly" ^^^ Modifier.ReadOnly
| "protected" ^^^ Modifier.Protected
)
| lexical.Identifier("abstract") ^^^ Modifier.Abstract
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting for the ) was broken here (there should be only 2 spaces before it).

@@ -139,7 +139,8 @@ class Printer(private val output: PrintWriter, outputPackage: String) {
if (sym.modifiers(Modifier.Const)) "val"
else if (sym.modifiers(Modifier.ReadOnly)) "def"
else "var"
pln" $access$decl $name: ${sym.tpe} = js.native"
p" $access$decl $name: ${sym.tpe}"
pln"${if (sym.modifiers(Modifier.Abstract)) "" else " = js.native"}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the following would be more readable:

if (!sym.modifiers(Modifier.Abstract))
  p" = js.native"
pln""

@@ -158,7 +159,8 @@ class Printer(private val output: PrintWriter, outputPackage: String) {
p" ${modifiers}def $name"
if (!sym.tparams.isEmpty)
p"[${sym.tparams}]"
pln"($params): ${sym.resultType} = js.native"
p"($params): ${sym.resultType}"
pln"${if (sym.modifiers(Modifier.Abstract)) "" else " = js.native"}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same readability comment here.

@sjrd
Copy link
Owner

sjrd commented Dec 4, 2017

This should now be rebased on master, and the .ts files be renamed to .d.ts to adapt to the changes done in #56.

@sbrunk
Copy link
Contributor Author

sbrunk commented Dec 7, 2017

Rebased and nitpicks should have been addressed, too :)

Copy link
Owner

@sjrd sjrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@sjrd sjrd merged commit 82b2746 into sjrd:master Dec 7, 2017
@sbrunk sbrunk deleted the abstract-classes branch December 7, 2017 09:39
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

Successfully merging this pull request may close these issues.

2 participants