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

Compile error when class method has empty return #612

Closed
gilbert opened this issue Mar 7, 2017 · 0 comments
Closed

Compile error when class method has empty return #612

gilbert opened this issue Mar 7, 2017 · 0 comments

Comments

@gilbert
Copy link
Contributor

gilbert commented Mar 7, 2017

Bug Report

Generating code for TemplateRoot node failed. Error: TypeError: Cannot read property 'type' of null

Context

class {
  subscribeToNewsletter (e) {
    return; // <-- The culprit
  }
}

<macro test(arg)>
  <p>${arg}</p>
</macro>

<div>
  <test('email') />
</div>
Additional Info

Your Environment

  • Version used: v4.0.0
  • Environment name and version (e.g. Chrome 39, node.js 5.4): node 6.9.1

Stack Trace

[marko-starter init] Error starting server. Error: Generating code for TemplateRoot node failed. Error: TypeError: Cannot read property 'type' of null
    at module.exports (/Users/tapwater/p/src/marko-issue/node_modules/raptor-util/createError.js:7:50)
    at CodeGenerator._invokeCodeGenerator (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/CodeGenerator.js:138:19)
    at CodeGenerator._generateCode (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/CodeGenerator.js:219:38)
    at CodeGenerator.generateCode (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/CodeGenerator.js:263:14)
    at Compiler.compile (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/Compiler.js:162:38)
    at _compile (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/index.js:89:33)
    at Object.compileFile (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/index.js:136:16)
    at loadFile (/Users/tapwater/p/src/marko-issue/node_modules/marko/runtime/loader/index-default.js:94:34)
    at doLoad (/Users/tapwater/p/src/marko-issue/node_modules/marko/runtime/loader/index-default.js:146:24)
    at load (/Users/tapwater/p/src/marko-issue/node_modules/marko/runtime/loader/index-default.js:5:16)
Caused by: TypeError: Cannot read property 'type' of null
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:24:20)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:206:32)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:15:33)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:59:28)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:120:28)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:199:29)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:15:33)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:188:34)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:102:24)
    at convert (/Users/tapwater/p/src/marko-issue/node_modules/marko/compiler/util/parseJavaScript.js:183:28)
@patrick-steele-idem patrick-steele-idem changed the title Compile error when returning from class method and using a macro Compile error when class method has empty return Mar 7, 2017
patrick-steele-idem added a commit that referenced this issue Mar 7, 2017
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

1 participant