Skip to content

Instantly share code, notes, and snippets.

@pastak
Created November 16, 2016 11:17
Show Gist options
  • Save pastak/258373c00b8d928ec88a9a7dccd30627 to your computer and use it in GitHub Desktop.
Save pastak/258373c00b8d928ec88a9a7dccd30627 to your computer and use it in GitHub Desktop.
const b = require('./b')
class A {
constructor () {
}
echo () {
console.log(b.hello)
}
lang () {
return 'ja'
}
}
module.exports = A;
const A = require('./a')
class B {
constructor () {
throw new Error('aaa')
}
static get hello () {
const a = new A()
if (a.lang() === 'ja') {
return 'こんにちは〜'
}
return 'hello'
}
}
module.exports = B;
@pastak
Copy link
Author

pastak commented Nov 16, 2016

> const A = require('./a')
> const a = new A()
> a.echo
TypeError: A.lang is not a function
    at Function.get hello [as hello] (/private/tmp/scratch/b.js:8:11)
    at A.echo (/private/tmp/scratch/a.js:8:18)
    at repl:1:3
    at sigintHandlersWrap (vm.js:22:35)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInThisContext (vm.js:21:12)
    at REPLServer.defaultEval (repl.js:313:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:513:10)

@tyage
Copy link

tyage commented Nov 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment