hleumas / coffee-script Goto Github PK
View Code? Open in Web Editor NEWThis project forked from jashkenas/coffeescript
Unfancy JavaScript
Home Page: http://coffeescript.org/
License: MIT License
This project forked from jashkenas/coffeescript
Unfancy JavaScript
Home Page: http://coffeescript.org/
License: MIT License
Hi,
First of all, thank you for creating this fork. It's exactly what I've been looking for.
I ran into an issue where the closure compiler throws an error when a short alias is used in an include within a namespaced Class.
For example, the following compiles fine:
include test.Test3 as test3
class Test extends test.Test2
constructor: ->
console.log("i am test")
However, if you qualify Test with a package name, it throws an error:
include test.Test3 as test3
class test.Test extends test.Test2
constructor: ->
console.log("i am test")
java.lang.RuntimeException: java.lang.RuntimeException: INTERNAL COMPILER ERROR.
Please report this problem.
null
Node(NAME Arguments): externs.zip//es3.js:30:9
function Arguments() {}
Parent(FUNCTION Arguments): externs.zip//es3.js:30:0
function Arguments() {}
at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:740)
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:652)
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:608)
at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:778)
at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:372)
at com.google.javascript.jscomp.CommandLineRunner.main(CommandLineRunner.java:993)
Now, if you remove the shortalias, it compiles fine again:
include test.Test3
class test.Test extends test.Test2
constructor: ->
console.log("i am test")
Any thoughts as to why this might be happening?
Thanks!
Hi, I've figured out how to get grunt-contrib-coffee to build using your fork and the goog option:
coffee: {
build: {
options: {
bare: true,
goog: true
},
expand: true,
cwd: 'src',
dest: 'build',
src: ['**/*.coffee'],
ext: '.js'
}
},
But I had to go in and manually override their reference to coffee-script :( Anyway, I've put in a pull-request to them to allow me to specify the compiler myself so that I can use yours in the build process that I'm automating.
Awesome work. Thank you. I hope you keep going with it.
Hi,
Have you tried suggesting to the main repo team to include this feature in it?
Cheers,
Chris
On this wiki page there is example outputted code.
// Generated by CoffeeScript 1.6.1
goog.provide('project.sub.someClass');
goog.require('project.sub2.anotherClass');
goog.scope(function(){
/**
This is an awesome constructor
@constructor
@extends project.sub2.anotherClass
*/
project.sub.someClass = function() {
this.doSomeStuff();
project.sub.someClass.superClass_.constructor.call(this);
}
goog.inherits(project.sub.someClass, project.sub2.anotherClass);
var someClass = project.sub.someClass;
project.sub.someClass.staticMethod = function() {
return alert(someClass.staticProperty);
};
project.sub.someClass.staticProperty = "Some value";
project.sub.someClass.prototype.doSomeStuff = function() {
return alert("Doing some stuff!");
};
});
I tried copying and pasting that into the closure compiler appspot and selecting advanced, for the optimization category. I see this error:
JSC_MISSING_PROVIDE_ERROR: required "project.sub2.anotherClass" namespace never provided at line 3 character 0
goog.require('project.sub2.anotherClass');
^
Is the code not supposed to compile as posted, or did something change in the closure compiler since this was posted?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.