fix(setup): use upstream traceur with explicit patches

Also correct the transpile to ES6

Also support generics correctly

All patches are hooked in via `/tools/transpiler/index.js`
https://github.com/google/traceur-compiler/issues/1700
https://github.com/google/traceur-compiler/issues/1699
https://github.com/google/traceur-compiler/issues/1708
https://github.com/google/traceur-compiler/issues/1625
https://github.com/google/traceur-compiler/issues/1706
This commit is contained in:
Tobias Bosch
2015-02-06 13:38:52 -08:00
parent 63d8107d1c
commit f39c6dc2c7
46 changed files with 515 additions and 125 deletions

View File

@ -8,6 +8,7 @@ export class AbstractChangeDetector extends ChangeDetector {
mode:string;
constructor() {
super();
this.children = [];
this.mode = CHECK_ALWAYS;
}

View File

@ -19,15 +19,15 @@ export class ArrayChanges {
_length:int;
_linkedRecords:_DuplicateMap;
_unlinkedRecords:_DuplicateMap;
_previousItHead:CollectionChangeRecord<V>;
_itHead:CollectionChangeRecord<V>;
_itTail:CollectionChangeRecord<V>;
_additionsHead:CollectionChangeRecord<V>;
_additionsTail:CollectionChangeRecord<V>;
_movesHead:CollectionChangeRecord<V>;
_movesTail:CollectionChangeRecord<V> ;
_removalsHead:CollectionChangeRecord<V>;
_removalsTail:CollectionChangeRecord<V>;
_previousItHead:CollectionChangeRecord;
_itHead:CollectionChangeRecord;
_itTail:CollectionChangeRecord;
_additionsHead:CollectionChangeRecord;
_additionsTail:CollectionChangeRecord;
_movesHead:CollectionChangeRecord;
_movesTail:CollectionChangeRecord;
_removalsHead:CollectionChangeRecord;
_removalsTail:CollectionChangeRecord;
constructor() {
this._collection = null;

View File

@ -4,6 +4,7 @@ export class ExpressionChangedAfterItHasBeenChecked extends Error {
message:string;
constructor(proto:ProtoRecord, change:any) {
super();
this.message = `Expression '${proto.expressionAsString}' has changed after it was checked. ` +
`Previous value: '${change.previousValue}'. Current value: '${change.currentValue}'`;
}
@ -19,6 +20,7 @@ export class ChangeDetectionError extends Error {
location:string;
constructor(proto:ProtoRecord, originalException:any) {
super();
this.originalException = originalException;
this.location = proto.expressionAsString;
this.message = `${this.originalException} in [${this.location}]`;

View File

@ -36,6 +36,7 @@ export class EmptyExpr extends AST {
export class Structural extends AST {
value:AST;
constructor(value:AST) {
super();
this.value = value;
}
@ -64,6 +65,7 @@ export class ImplicitReceiver extends AST {
export class Chain extends AST {
expressions:List;
constructor(expressions:List) {
super();
this.expressions = expressions;
}
@ -86,6 +88,7 @@ export class Conditional extends AST {
trueExp:AST;
falseExp:AST;
constructor(condition:AST, trueExp:AST, falseExp:AST){
super();
this.condition = condition;
this.trueExp = trueExp;
this.falseExp = falseExp;
@ -110,6 +113,7 @@ export class AccessMember extends AST {
getter:Function;
setter:Function;
constructor(receiver:AST, name:string, getter:Function, setter:Function) {
super();
this.receiver = receiver;
this.name = name;
this.getter = getter;
@ -155,6 +159,7 @@ export class KeyedAccess extends AST {
obj:AST;
key:AST;
constructor(obj:AST, key:AST) {
super();
this.obj = obj;
this.key = key;
}
@ -187,6 +192,7 @@ export class Formatter extends AST {
args:List<AST>;
allArgs:List<AST>;
constructor(exp:AST, name:string, args:List) {
super();
this.exp = exp;
this.name = name;
this.args = args;
@ -201,6 +207,7 @@ export class Formatter extends AST {
export class LiteralPrimitive extends AST {
value;
constructor(value) {
super();
this.value = value;
}
@ -216,6 +223,7 @@ export class LiteralPrimitive extends AST {
export class LiteralArray extends AST {
expressions:List;
constructor(expressions:List) {
super();
this.expressions = expressions;
}
@ -232,6 +240,7 @@ export class LiteralMap extends AST {
keys:List;
values:List;
constructor(keys:List, values:List) {
super();
this.keys = keys;
this.values = values;
}
@ -253,6 +262,7 @@ export class Interpolation extends AST {
strings:List;
expressions:List;
constructor(strings:List, expressions:List) {
super();
this.strings = strings;
this.expressions = expressions;
}
@ -271,6 +281,7 @@ export class Binary extends AST {
left:AST;
right:AST;
constructor(operation:string, left:AST, right:AST) {
super();
this.operation = operation;
this.left = left;
this.right = right;
@ -310,6 +321,7 @@ export class Binary extends AST {
export class PrefixNot extends AST {
expression:AST;
constructor(expression:AST) {
super();
this.expression = expression;
}
@ -326,6 +338,7 @@ export class Assignment extends AST {
target:AST;
value:AST;
constructor(target:AST, value:AST) {
super();
this.target = target;
this.value = value;
}
@ -345,6 +358,7 @@ export class MethodCall extends AST {
args:List;
name:string;
constructor(receiver:AST, name:string, fn:Function, args:List) {
super();
this.receiver = receiver;
this.fn = fn;
this.args = args;
@ -375,6 +389,7 @@ export class FunctionCall extends AST {
target:AST;
args:List;
constructor(target:AST, args:List) {
super();
this.target = target;
this.args = args;
}
@ -397,6 +412,7 @@ export class ASTWithSource extends AST {
source:string;
location:string;
constructor(ast:AST, source:string, location:string) {
super();
this.source = source;
this.location = location;
this.ast = ast;
@ -429,6 +445,7 @@ export class TemplateBinding {
name:string;
expression:ASTWithSource;
constructor(key:string, keyIsVar:boolean, name:string, expression:ASTWithSource) {
super();
this.key = key;
this.keyIsVar = keyIsVar;
// only either name or expression will be filled.

View File

@ -184,6 +184,7 @@ const $NBSP = 160;
export class ScannerError extends Error {
message:string;
constructor(message) {
super();
this.message = message;
}

View File

@ -104,6 +104,7 @@ export class DynamicProtoChangeDetector extends ProtoChangeDetector {
_recordBuilder:ProtoRecordBuilder;
constructor() {
super();
this._records = null;
this._recordBuilder = new ProtoRecordBuilder();
}
@ -131,6 +132,7 @@ export class JitProtoChangeDetector extends ProtoChangeDetector {
_recordBuilder:ProtoRecordBuilder;
constructor() {
super();
this._factory = null;
this._recordBuilder = new ProtoRecordBuilder();
}

View File

@ -9,6 +9,7 @@ export class EventEmitter extends DependencyAnnotation {
eventName: string;
@CONST()
constructor(eventName) {
super();
this.eventName = eventName;
}
}

View File

@ -8,6 +8,7 @@ import {DependencyAnnotation} from 'angular2/di';
export class Parent extends DependencyAnnotation {
@CONST()
constructor() {
super();
}
}
@ -18,5 +19,6 @@ export class Parent extends DependencyAnnotation {
export class Ancestor extends DependencyAnnotation {
@CONST()
constructor() {
super();
}
}

View File

@ -15,6 +15,7 @@ import {DirectiveMetadata} from './directive_metadata';
import {Component} from '../annotations/annotations';
import {Content} from './shadow_dom_emulation/content_tag';
import {ShadowDomStrategy} from './shadow_dom_strategy';
import {CompileStep} from './pipeline/compile_step';
/**
* Cache that stores the ProtoView of the template of a component.

View File

@ -640,6 +640,7 @@ export class ElementInjector extends TreeNode {
class OutOfBoundsAccess extends Error {
message:string;
constructor(index) {
super();
this.message = `Index ${index} is out-of-bounds.`;
}

View File

@ -30,6 +30,7 @@ import {ShadowDomStrategy} from '../shadow_dom_strategy';
export class DirectiveParser extends CompileStep {
_selectorMatcher:SelectorMatcher;
constructor(directives:List<DirectiveMetadata>) {
super();
this._selectorMatcher = new SelectorMatcher();
for (var i=0; i<directives.length; i++) {
var directiveMetadata = directives[i];

View File

@ -89,6 +89,7 @@ export class ElementBinderBuilder extends CompileStep {
_parser:Parser;
_compilationUnit:any;
constructor(parser:Parser, compilationUnit:any) {
super();
this._parser = parser;
this._compilationUnit = compilationUnit;
}

View File

@ -32,6 +32,7 @@ export class PropertyBindingParser extends CompileStep {
_parser:Parser;
_compilationUnit:any;
constructor(parser:Parser, compilationUnit:any) {
super();
this._parser = parser;
this._compilationUnit = compilationUnit;
}

View File

@ -25,6 +25,7 @@ export class ProtoViewBuilder extends CompileStep {
changeDetection:ChangeDetection;
_shadowDomStrategy:ShadowDomStrategy;
constructor(changeDetection:ChangeDetection, shadowDomStrategy:ShadowDomStrategy) {
super();
this._shadowDomStrategy = shadowDomStrategy;
this.changeDetection = changeDetection;
}

View File

@ -17,6 +17,7 @@ export class TextInterpolationParser extends CompileStep {
_parser:Parser;
_compilationUnit:any;
constructor(parser:Parser, compilationUnit:any) {
super();
this._parser = parser;
this._compilationUnit = compilationUnit;
}

View File

@ -36,6 +36,7 @@ export class ViewSplitter extends CompileStep {
_parser:Parser;
_compilationUnit:any;
constructor(parser:Parser, compilationUnit:any) {
super();
this._parser = parser;
this._compilationUnit = compilationUnit;
}

View File

@ -10,7 +10,7 @@ var _scriptTemplate = DOM.createScriptTag('type', 'ng/content')
class ContentStrategy {
nodes: List<Node>;
insert(nodes:List<Nodes>){}
insert(nodes:List<Node>){}
}
/**
@ -23,6 +23,7 @@ class RenderedContent extends ContentStrategy {
endScript:Element;
constructor(contentEl:Element) {
super();
this._replaceContentElementWithScriptTags(contentEl);
this.nodes = [];
}
@ -64,6 +65,7 @@ class IntermediateContent extends ContentStrategy {
destinationLightDom:LightDom;
constructor(destinationLightDom:LightDom) {
super();
this.destinationLightDom = destinationLightDom;
this.nodes = [];
}

View File

@ -18,6 +18,7 @@ export class EmulatedShadowDomStrategy extends ShadowDomStrategy {
_styleHost: Element;
constructor(styleHost: Element = null) {
super();
if (isBlank(styleHost)) {
styleHost = DOM.defaultDoc().head;
}

View File

@ -1,6 +1,6 @@
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
import {isBlank, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
import {TemplateElement, DOM} from 'angular2/src/facade/dom';
import {TemplateElement, DOM, Element} from 'angular2/src/facade/dom';
import {StringMapWrapper} from 'angular2/src/facade/collection';
import {TemplateConfig} from 'angular2/src/core/annotations/template_config';

View File

@ -32,6 +32,7 @@ export class ProviderError extends Error {
constructResolvingMessage:Function;
message;
constructor(key:Key, constructResolvingMessage:Function) {
super();
this.keys = [key];
this.constructResolvingMessage = constructResolvingMessage;
this.message = this.constructResolvingMessage(this.keys);
@ -87,6 +88,7 @@ export class InstantiationError extends ProviderError {
export class InvalidBindingError extends Error {
message:string;
constructor(binding) {
super();
this.message = `Invalid binding ${binding}`;
}
@ -98,6 +100,7 @@ export class InvalidBindingError extends Error {
export class NoAnnotationError extends Error {
message:string;
constructor(typeOrFunc) {
super();
this.message = `Cannot resolve all parameters for ${stringify(typeOrFunc)}`;
}

View File

@ -16,6 +16,7 @@ export class Foreach extends OnChange {
viewPort: ViewPort;
iterable;
constructor(viewPort: ViewPort) {
super();
this.viewPort = viewPort;
}
onChange(changes) {

View File

@ -18,7 +18,6 @@ export class CONST {}
export class ABSTRACT {}
export class IMPLEMENTS {}
export function isPresent(obj):boolean {
return obj !== undefined && obj !== null;
}
@ -103,6 +102,7 @@ export class StringJoiner {
export class NumberParseError extends Error {
constructor(message) {
super();
this.message = message;
}

View File

@ -89,6 +89,7 @@ export class ControlGroupDirective extends ControlGroupDirectiveBase {
_directives:List<ControlNameDirective>;
constructor() {
super();
this._directives = ListWrapper.create();
}
@ -121,6 +122,7 @@ export class NewControlGroupDirective extends ControlGroupDirectiveBase {
_directives:List<ControlNameDirective>;
constructor() {
super();
this._directives = ListWrapper.create();
}

View File

@ -9,6 +9,7 @@ export class XHRMock extends XHR {
_requests: List<Promise>;
constructor() {
super();
this._expectations = [];
this._definitions = MapWrapper.create();
this._requests = [];