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

uncommented out class module stuff #2

Open
wants to merge 1 commit into
base: modules
Choose a base branch
from

Conversation

xjamundx
Copy link

@xjamundx xjamundx commented Mar 5, 2015

Let me know what else is needed here. That seemed way too easy.

@caridy
Copy link
Owner

caridy commented Mar 5, 2015

looking good, but tests are missing. We need to add tests for:

  • export default class foo {}
  • export default class {}
  • export default class foo extends bar {}
  • export default class extends bar {}
  • export class foo {}
  • export class foo extends bar {}

that's from the top of my head...

@xjamundx
Copy link
Author

xjamundx commented Mar 5, 2015

k added all of those tests

"index": 21,
"lineNumber": 1,
"column": 22,
"description": "Unexpected reserved word"
Copy link
Owner

Choose a reason for hiding this comment

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

well, this one is certainly valid :), there is something wrong with the code, maybe on my code :)

this is sugar for:

var foo = class extends bar {};
export default foo;

Copy link
Author

Choose a reason for hiding this comment

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

i just generated the tests with espree, let me try to turn back on esprima-fb and see if that works

Copy link
Author

Choose a reason for hiding this comment

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

esprima-fb gives:

module.exports = {
    "index": 0,
    "lineNumber": 1,
    "column": 1,
    "description": "Illegal export declaration"
}

for: export default class extends bar {};

acorn gives a fairly different AST IMO:

{
   "type": "Program",
   "start": 0,
   "end": 36,
   "body": [
      {
         "type": "ExportDeclaration",
         "start": 0,
         "end": 36,
         "declaration": {
            "type": "ClassExpression",
            "start": 15,
            "end": 35,
            "id": null,
            "superClass": {
               "type": "Identifier",
               "start": 29,
               "end": 32,
               "name": "bar"
            },
            "body": {
               "type": "ClassBody",
               "start": 33,
               "end": 35,
               "body": []
            }
         },
         "default": true,
         "specifiers": null,
         "source": null
      }
   ]
}

@caridy
Copy link
Owner

caridy commented Mar 5, 2015

dude, you really need an editor that automatically add the breakline at the end jajajaja. those red arrows are hurting my eyes jajaja.

@xjamundx
Copy link
Author

xjamundx commented Mar 5, 2015

@caridy yeah what do you want me to do about this breakline stuff? Happy to do whatever you want. I'm on mac/webstorm.

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