google / traceur-compiler Goto Github PK
View Code? Open in Web Editor NEWTraceur is a JavaScript.next-to-JavaScript-of-today compiler
License: Apache License 2.0
Traceur is a JavaScript.next-to-JavaScript-of-today compiler
License: Apache License 2.0
Original author: [email protected] (April 19, 2011 19:04:41)
Should there be a standard library function for doing this? In C# you have enumerable.ToArray() for this purpose.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=7
Original author: [email protected] (April 21, 2011 21:28:31)
According to arv:
(tempCtor = function() { });
This rewrite is not correct. It needs to be
(tempCtor = function tempCtor() { });
since the name of is exposed as the .name property of a function.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=11
Original author: [email protected] (May 11, 2011 22:15:54)
Remove the unnecessary dependencies on proto
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=21
Original author: [email protected] (April 21, 2011 00:44:25)
They should be allowed anywhere functions are. As with functions in ES.next, they should be let-bound in their containing block scope.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=10
Original author: [email protected] (April 19, 2011 19:02:22)
We don't currently support trait constructors in the syntax/implementation. See demo/traitsCircle.js
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=5
Original author: [email protected] (May 11, 2011 22:33:11)
I have a simple script loader based on the contents of bootstrap.js. It works perfectly as far as loading and executing the included scripts. The problem is that if I try to use any variables defined in the loaded file, the compiler sees an "undefined" variable before loading the scripts and never executes the script that loaded the file.
Is there a reason that the compiler has to stop when it encounters an undefined variable? This is already done by the interpreter so I don't see why the compiler should throw an exception. Also, there should be a script loader built in.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=22
Original author: unigossi (June 09, 2011 19:17:04)
I don't know what's the plan for harmony, but with the current implementation of tracuer it isn't possible to have one module in multiple files.
At the moment code like this:
module m {
}
is turned into:
var m =(function() {
"use strict";
return this;
}).call(Object.create(null));
can't it be:
var m =(function() {
"use strict";
return this;
}).call(m || Object.create(null));
The original thought by me was doing sth like this:
Class1.js:
module m {
export class Class1 {
//...
}
}
Class2.js:
module m {
export class Class2 {
//...
}
}
Will this be possible?
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=32
Original author: [email protected] (May 12, 2011 00:17:55)
We currently use Closure Library testing framework which is similar to JSUnit. The current testing framework depends on globals (not entirely true but we use them for convenience) but Harmony is all about strict mode and true lexical scoping so globals are bad.
I was trying to change to using strict evals in the tests but since you cannot introduce new bindings a lot of tests started failing.
This made me want to get rid of Closure library tests and either use Jasmine or build something simple ourselves.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=23
Original author: [email protected] (May 17, 2011 11:34:31)
return [item for (item in values)].join(delimiter || "|");
repl(1, 14): ',' expected
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=31
Original author: [email protected] (May 05, 2011 14:50:41)
Traceur needs the ability to enable/disable experiments based on runtime configuration so that things which are more experimental can be turned on/off separately from features which track more solidified Harmony proposals.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=14
Original author: [email protected] (October 13, 2011 19:43:35)
We should implement quasi literals as specified in http://wiki.ecmascript.org/doku.php?id=harmony:quasis.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=47
Original author: [email protected] (May 04, 2011 03:02:08)
We currently have a runtime method called spreadNew. It incorrectly uses Object.create and apply. We need to use bind instead. This is so that the following works:
new Date(...[2011, 4, 3])
We need to do something like this instead
new (Date.bind(undefined, 2011, 4, 3))
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=12
Original author: [email protected] (May 16, 2011 17:59:03)
Our current syntax is very much out of sync with the latest proposals.
http://wiki.ecmascript.org/doku.php?id=strawman:classes_with_trait_composition
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=28
Original author: [email protected] (September 21, 2011 06:32:32)
Destructuring should work in more cases
function(pattern) {
set setter(pattern) {
for (var pattern in expr) {
for (pattern in expr) {
for (var pattern : expr) { // or "of" depending on what we end up with
for (pattern : expr) {
try { ... } catch (pattern) {
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=42
Original author: aikar%[email protected] (September 18, 2011 13:57:30)
What steps will reproduce the problem?
What is the expected output? What do you see instead?
for spread to work, spread doesnt work
What version of the product are you using? On what operating system?
v0.10 - Ubuntu 11.04 x64 - Node.JS v0.4.11
Please provide any additional information below.
My code that didn't work:
class Config {
class get(...args) {
return Config.getInstance().getConf(...args)
}
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=39
Original author: [email protected] (September 25, 2011 01:41:07)
What steps will reproduce the problem?
What is the expected output? What do you see instead?
The expected output is "C" and no error messages. Instead i see a error message due to Project.getModuleForUrl being called before Project.addExternalModule and therefore failing on the assert causing Error('Assertion failed').
What version of the product are you using? On what operating system?
I'm running from trunk revision r325 in Chrome 16.0.899.0
Please provide any additional information below.
The tests in tests/unit/runtime/test_modules.html all pass on my browser but as far as I can see it doesn't use Compiler.js but instead CodeLoader from modules.js
When should Project.addExternalModule be called for require statements? I have looked at the code but because the CodeLoader and the Compiler is quite different I do not really understand where code loading should be performed when using the Compiler.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=44
Original author: [email protected] (July 15, 2011 16:05:28)
This piece of code does compile but bails out when validating the parse tree although it looks perfectly fine to me:
function makeSync(fn) {
return function() {
var self = this;
var callArgs = Array.prototype.slice.call(arguments);
var err, args;
function callDeferred() {
var deferred = new Deferred();
fn.apply(self, callArgs.concat(function(err, varargs) {
if (err) {
deferred.errback(err);
} else {
args = Array.prototype.slice.call(arguments, 1)
deferred.callback(args);
}
}));
return deferred;
}
await callDeferred();
return args;
}
};
The error I get is:
"Error: Parse tree validation failure 'statement expected' at (unknown):"
I'm using the version embedded into https://github.com/aikar/traceur so I don't knwo exactly which svn revision it is.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=34
Original author: [email protected] (April 20, 2011 18:13:24)
we should implement "yield for" to use nested iterators:
http://research.microsoft.com/en-us/projects/specsharp/iterators.pdf
they're a big perf win for deeply nested iterators.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=9
Original author: [email protected] (May 04, 2011 16:11:10)
Need a getting started page for using traceur with node.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=13
Original author: [email protected] (May 11, 2011 21:09:48)
Currently we only have one kind of Module symbol.
module m { ... }
module n = ...
However, it would be a lot clearer to have two different symbols here.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=20
Original author: [email protected] (May 09, 2011 23:14:37)
See the example at:
It doesn't compile yet. There's a TODO in the parser:
// TODO: await should be an expression, not a statement
// await[ identifier = ] expression;
/** ... */
parseAwaitStatement_: function() {
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=18
Original author: [email protected] (September 22, 2011 16:09:29)
Assigning to arguments is dissallowed in ES5 strict and in Harmony. However,
function f() {
[arguments] = [1];
}
does not fail because we do alpha rename of arguments. The generated code assigns to $arguments instead which does not fail.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=43
Original author: [email protected] (May 17, 2011 11:32:56)
function foo() {
let bar = {};
yield undefined;
}
repl(2, 5): traceur: const/let declaration may not be in a block
containing a yield.
This code should work fine.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=30
Original author: [email protected] (April 19, 2011 19:07:22)
In C# you can use generators to define the GetEnumerator() method. It's not clear to me that this works in the current implementation, because our generators always return an object with iterator. In C# parlance this is the difference between a generator that returns IEnumerator<T> vs IEnumerable<T>. How do we do it in JS without strong types?
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=8
Original author: [email protected] (May 06, 2011 00:07:18)
Node.js is all about async I/O which is exactly what await was designed for.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=16
Original author: [email protected] (August 15, 2011 19:33:22)
http://wiki.ecmascript.org/doku.php?id=harmony:concise_object_literal_extensions#methods
Allows:
var obj = {
prop: 42,
method() {
return this.prop;
}
};
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=35
Original author: [email protected] (May 12, 2011 18:04:26)
This code fails in outside a function because we generate code that has arguments in it.
var a, b, c, d;
[a, [b], c, d] = ['hello', [',', 'junk'], ['world']];
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=24
Original author: [email protected] (June 24, 2011 05:43:57)
Lots of people use JS to build HTML or larger string, and it's painful
to write multiple lines of HTML with 80 characters limit.
Instead of doing:
var html = '<div>' +
'hello' +
'</div>';
This should be:
var html = """
<div>
hello
</div>
""";
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=33
Original author: [email protected] (May 16, 2011 16:36:04)
We currently haven't implemented import which makes modules pretty limited.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=26
Original author: [email protected] (May 09, 2011 16:39:11)
Object.create is the more 'standard' way
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=17
Original author: [email protected] (October 14, 2011 00:21:29)
We should implement the "prototype for" literal <| as specified in http://wiki.ecmascript.org/doku.php?id=harmony:object_literals and http://wiki.ecmascript.org/doku.php?id=harmony:proto_operator
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=48
Original author: [email protected] (April 15, 2011 22:37:37)
Currently BlockBinding is always generated with try/catch. We should try to use functions when possible.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=3
Original author: [email protected] (August 16, 2011 18:31:36)
We currently use
for (var value : iter)
but the latest proposal uses
for (var value of iter)
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=38
Original author: [email protected] (May 13, 2011 17:41:35)
We currently rely on writable proto to get something that almost works as inheriting from DOM classes. Writable proto is not part of ES5 and IE9/10 does not support it.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=25
Original author: [email protected] (August 15, 2011 19:38:37)
From Narcissus...
Comma Optional After Method and Accessor Properties in Object Literals.
(There is not currently an separate Harmony proposal for this feature)
Within an object literal the comma that separates individual property definitions is optional after method and accessor property definitions. For example this:
var obj = {
a: 0,
__foo: null,
someMethod() {
doSomething();
}
get foo() {return __foo}
set foo(v) {__foo = v}
}
means exactly the same thing as:
var obj = {
a: 0,
__foo: null,
someMethod() {
doSomething();
}, //<-- note comma
get foo() {return __foo}, //<-- note comma
set foo(v) {__foo = v}
}
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=36
Original author: [email protected] (May 11, 2011 19:04:53)
iterator is used by SpiderMonkeys for-in loops (sigh) so we need to change this. I have a patch that just renames this to traceurIterator but we need to track ES Harmony here to come up with a non hacky solution.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=19
Original author: aikar%[email protected] (September 19, 2011 12:18:53)
What steps will reproduce the problem?
Make the following class:
class foo { class init(bar = null) { console.log("Foo"); } }
Witness error:
TypeError: Cannot read property 'value' of undefined
at /home/aikar/projects/nodeib/node_modules/traceur/traceur/src/codegeneration/ParseTreeFactory.js:158:47
at Array.forEach (native)
at createParameters (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/codegeneration/ParseTreeFactory.js:155:26)
at Object.transformStaticMethodAssignment_ (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/codegeneration/ClassTransformer.js:309:15)
at Object.<anonymous> (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/codegeneration/ClassTransformer.js:219:30)
at Array.forEach (native)
at Object.createStaticMembers_ (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/codegeneration/ClassTransformer.js:216:30)
at Object.transformClassDeclaration (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/codegeneration/ClassTransformer.js:162:40)
at Object.transformAny (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/codegeneration/ParseTreeTransformer.js:115:37)
at Object.transformList (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/codegeneration/ParseTreeTransformer.js:131:32)
What is the expected output? What do you see instead?
want: Foo
see: Error
What version of the product are you using? On what operating system?
latest trunk as of sep 19/11
Please provide any additional information below.
May be related to http://code.google.com/p/traceur-compiler/issues/detail?id=39 which I also reported as an issue with static class methods.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=40
Original author: [email protected] (May 16, 2011 21:15:41)
Attempt to compile "let foo;" and traceur reports:
repl(1, 8): let/const in for statement must have an initializer
This isn't in a for statement, and the same statement works in Spidermonkey. I don't think it should be an error in the first place.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=29
Original author: [email protected] (October 13, 2011 13:37:44)
Implementation of string extras directly taken from harmony proposal.
Issue #45.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=46
Original author: [email protected] (April 12, 2011 22:33:54)
arv had the following comments about this code:
https://chromereviews.googleplex.com/2741024/diff/1/src/semantics/BoundIdentifierAccumulator.js
File src/semantics/BoundIdentifierAccumulator.js (right):
https://chromereviews.googleplex.com/2741024/diff/1/src/semantics/BoundIdentifierAccumulator.js#newcode85
src/semantics/BoundIdentifierAccumulator.js:85: * Then only {@code "f"}
is bound; {@code "x"} and {@code "y"} are
I find this confusing. Maybe it is just a documentation issue.
Can you add a test that the bound identifiers in the following statement
does not include f?
var x = function f() {};
https://chromereviews.googleplex.com/2741024/diff/1/src/semantics/BoundIdentifierAccumulator.js#newcode108
src/semantics/BoundIdentifierAccumulator.js:108: * enclosing scope.
Yeah, the text here is really confusing. A function expression makes the
name of the function bound in the function body, but the name of the
function is not seen outside the function.
https://chromereviews.googleplex.com/2741024/diff/1/src/semantics/BoundIdentifierAccumulator.js#newcode122
src/semantics/BoundIdentifierAccumulator.js:122: * Reports {@code "g"}
as being bound, because the function
This is incorrect. In ES5, function statements are not allowed in blocks
(most engines allow them but that is an extension). In ES.next function
statements in blocks have let binding.
I don't think we need to fix these issues in this patch but we should
file bugs.
https://chromereviews.googleplex.com/2741024/diff/1/src/semantics/BoundIdentifierAccumulator.js#newcode227
src/semantics/BoundIdentifierAccumulator.js:227:
Do we need to visit ForEachStatements too? Or is it guaranteed that the
for-each pass happens before this is used?
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=1
Original author: [email protected] (May 05, 2011 19:01:40)
Currently, our const variables are really not const.
There are a couple things we could do.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=15
Original author: [email protected] (April 15, 2011 21:21:49)
Erik pointed out some problems in the createClass implementation we've been using:
> https://chromereviews.googleplex.com/2793013/diff/3001/src/runtime.js#newcode183
> src/runtime.js:183: proto.proto = base.prototype;
> This is a red flag.
>
> In general it is not allowed to set the proto. There are some exceptions, like
> in an object literal and to work around limitations with extending DOM and built
> in classes.
>
> What is the intent and can we solve it some other way? I don't understand why we
> are changing the proto this way. The proto should already be an instanceof base
> before this statement.
>
> What happens if proto is used in more than one place?
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=2
Original author: [email protected] (October 07, 2011 16:41:55)
This one is trivial:
http://wiki.ecmascript.org/doku.php?id=harmony:string_extras
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=45
Original author: [email protected] (August 15, 2011 19:47:49)
http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=37
Original author: [email protected] (April 15, 2011 22:38:23)
I hit some errors trying to turn it on, they didn't seem the fault of the trees themselves.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=4
Original author: [email protected] (April 19, 2011 19:03:38)
Should generators work with blocked scoped vars? Seems like since these are both new features, they should be compatible. Right now "let" isn't even allowed in generator functions.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=6
Original author: aikar%[email protected] (September 19, 2011 12:31:03)
What steps will reproduce the problem?
What is the expected output? What do you see instead?
No error
What version of the product are you using? On what operating system?
latest trunk as of 9/19/11
Please provide any additional information below.
NOTE: To get traceur to work with node.js I had to disable the FreeVariableChecker like so:
traceur.semantics.FreeVariableChecker.checkProgram = function() {}
This is due to Traceur blowing up saying module was not defined.
also, to assist debugging I threw in an exception to get a stack trace:
Error: Missing URL
at Object.ModuleSymbol (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/semantics/symbols/ModuleSymbol.js:36:13)
at Object.Project (/home/aikar/projects/nodeib/node_modules/traceur/traceur/src/semantics/symbols/Project.js:45:24)
at Object..js (/home/aikar/projects/nodeib/node_modules/traceur/traceur.js:34:19)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at require (module.js:355:19)
at Object.<anonymous> (/home/aikar/projects/nodeib/node_modules/traceur/test.js:2:7)
at Module._compile (module.js:411:26)
at Object.<anonymous> (module.js:417:10)
at Module.load (module.js:343:31)
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=41
Original author: [email protected] (May 16, 2011 17:39:35)
Disclaimer: I know V8 does not support E4X and has no intention of adding it.
Users of E4X who target Firefox/Spidermonkey are still users of Javascript and can benefit from tools which exist for the language. Traceur is one such tool that can:
Please consider supporting optional E4X support in the Traceur parser to pass through to the output code so that Firefox/Spidermonkey users of E4X can use Traceur.
Also, if ECMA-357 ever changes, for instance, to remove XML literals from the token stream, users who wish to migrate from this syntax to something more benign will be able to take advantage of tools such as Traceur to do the rewriting. (e.g. "foo = <bar/>" -> "foo = new XML('<bar/>')")
Or, alternatively, using Traceur to rewrite E4X syntax to something else entirely (JSON?) in order to migrate code that only runs on Spidemonkey to run on V8 as well.
Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=27
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.