Skip to content

Commit 9d21a6f

Browse files
caitprkirov
authored andcommitted
chore(package.json): upgrade traceur to v0.0.87
Fix in source-map test to follow through the sourcemap chain.
1 parent d304f41 commit 9d21a6f

19 files changed

Lines changed: 52 additions & 56 deletions

File tree

docs/dgeni-package/services/atParser.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,18 @@ module.exports = function atParser(AttachCommentTreeVisitor, SourceFile, Traceur
3434
var sourceFile = new SourceFile(moduleName, fileInfo.content);
3535
var comments = [];
3636
var moduleTree;
37-
var parser = new TraceurParser(sourceFile);
37+
var errorReporter = {
38+
reportError: function(position, message) {
39+
}
40+
};
41+
42+
traceurOptions.setFromObject(service.traceurOptions);
43+
var parser = new TraceurParser(sourceFile, errorReporter, traceurOptions);
3844

3945
// Configure the parser
4046
parser.handleComment = function(range) {
4147
comments.push({ range: range });
4248
};
43-
traceurOptions.setFromObject(service.traceurOptions);
4449

4550
try {
4651
// Parse the file as a module, attaching the comments
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module.exports = function traceurOptions() {
2-
return System.get(System.map.traceur + '/src/Options.js').options;
2+
var Options = System.get(System.map.traceur + "/src/Options.js").Options;
3+
return new Options();
34
};

modules/angular2/src/core/annotations/annotations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,13 +717,13 @@ export class Decorator extends Directive {
717717
compileChildren:boolean
718718
}={})
719719
{
720-
this.compileChildren = compileChildren;
721720
super({
722721
selector: selector,
723722
bind: bind,
724723
events: events,
725724
lifecycle: lifecycle
726725
});
726+
this.compileChildren = compileChildren;
727727
}
728728
}
729729

modules/angular2/src/directives/for.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {ListWrapper} from 'angular2/src/facade/collection';
1313
export class For {
1414
viewContainer: ViewContainer;
1515
constructor(viewContainer:ViewContainer) {
16-
super();
1716
this.viewContainer = viewContainer;
1817
}
1918

modules/angular2/src/forms/directives.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class DefaultValueAccessor {
2222
onChange:Function;
2323

2424
constructor(@PropertySetter('value') setValueProperty:Function) {
25-
super();
2625
this._setValueProperty = setValueProperty;
2726
this.onChange = (_) => {};
2827
}
@@ -44,7 +43,6 @@ export class CheckboxControlValueAccessor {
4443
onChange:Function;
4544

4645
constructor(cd:ControlDirective, @PropertySetter('checked') setCheckedProperty:Function) {
47-
super();
4846
this._setCheckedProperty = setCheckedProperty;
4947
this.onChange = (_) => {};
5048
cd.valueAccessor = this; //ControlDirective should inject CheckboxControlDirective
@@ -126,7 +124,6 @@ export class ControlGroupDirective {
126124
_directives:List<ControlDirective>;
127125

128126
constructor(@Optional() @Ancestor() groupDirective:ControlGroupDirective) {
129-
super();
130127
this._groupDirective = groupDirective;
131128
this._directives = ListWrapper.create();
132129
}

modules/angular2/src/forms/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,4 @@ export class ControlArray extends AbstractControl {
228228
this._errors = this.validator(this);
229229
this._status = isPresent(this._errors) ? INVALID : VALID;
230230
}
231-
}
231+
}

modules/angular2/test/forms/integration_spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ class WrappedValue {
415415
onChange:Function;
416416

417417
constructor(cd:ControlDirective, @PropertySetter('value') setProperty:Function) {
418-
super();
419418
this._setProperty = setProperty;
420419
cd.valueAccessor = this;
421420
}

modules/examples/e2e_test/sourcemap/sourcemap_spec.es6

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('sourcemaps', function () {
2323
expect(errorLine).not.toBeNull();
2424
expect(errorColumn).not.toBeNull();
2525

26+
2627
var sourceMapData = fs.readFileSync(
2728
'dist/js/prod/es5/examples/src/sourcemap/index.js.map');
2829
var decoder = new sourceMap.SourceMapConsumer(JSON.parse(sourceMapData));
@@ -32,9 +33,15 @@ describe('sourcemaps', function () {
3233
column: errorColumn
3334
});
3435

36+
var finalMapData = fs.readFileSync(
37+
'dist/js/prod/es6/examples/src/sourcemap/index.map');
38+
var finalDecoder = new sourceMap.SourceMapConsumer(JSON.parse(finalMapData));
39+
40+
var finalPosition = finalDecoder.originalPositionFor(originalPosition);
41+
3542
var sourceCodeLines = fs.readFileSync('modules/examples/src/sourcemap/index.js',
3643
{encoding: 'UTF-8'}).split('\n');
37-
expect(sourceCodeLines[originalPosition.line - 1])
44+
expect(sourceCodeLines[finalPosition.line - 1])
3845
.toMatch(/throw new BaseException\(\'Sourcemap test\'\)/);
3946
});
4047
});

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"dependencies": {
2727
"es6-module-loader": "^0.9.2",
2828
"systemjs": "^0.9.1",
29-
"traceur": "0.0.82",
3029
"rx": "2.4.6",
30+
"traceur": "0.0.87",
3131
"which": "~1",
3232
"zone.js": "0.4.0",
3333
"googleapis": "1.0.x",
@@ -54,7 +54,7 @@
5454
"gulp-shell": "^0.2.10",
5555
"gulp-sourcemaps": "1.3.*",
5656
"gulp-template": "^3.0.0",
57-
"gulp-traceur": "0.16.*",
57+
"gulp-traceur": "0.17.*",
5858
"gulp-ts2dart": "^1.0.0",
5959
"gulp-webserver": "^0.8.7",
6060
"js-yaml": "^3.2.7",

tools/transpiler/index.js

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,9 @@ exports.compile = function compile(options, paths, source, reloadTraceur) {
4040
moduleName = moduleName || inputPath;
4141
moduleName = moduleName.replace(/\.\w*$/, '');
4242

43-
var localOptions = extend(options, {
44-
moduleName: moduleName
45-
});
4643
var CompilerCls = System.get('transpiler/src/compiler').Compiler;
4744

48-
var compiler = new CompilerCls(localOptions);
45+
var compiler = new CompilerCls(options, moduleName);
4946
var result = {
5047
js: compiler.compile(source, inputPath, outputPath),
5148
sourceMap: null
@@ -56,7 +53,7 @@ exports.compile = function compile(options, paths, source, reloadTraceur) {
5653
result.sourceMap = JSON.parse(sourceMapString);
5754
}
5855

59-
if (localOptions.outputLanguage === 'es6' && source.indexOf('$traceurRuntime') === -1) {
56+
if (options.outputLanguage === 'es6' && source.indexOf('$traceurRuntime') === -1) {
6057
assert(result.js.indexOf('$traceurRuntime') === -1,
6158
'Transpile to ES6 must not add references to $traceurRuntime, '
6259
+ inputPath + ' is transpiled to:\n' + result.js);
@@ -94,7 +91,6 @@ function reloadCompiler(reloadTraceur) {
9491
useRttsAssertModuleForConvertingTypesToExpressions();
9592
supportSuperCallsInEs6Patch();
9693
convertTypesToExpressionsInEs6Patch();
97-
removeNonStaticFieldDeclarationsInEs6Patch();
9894
disableGetterSetterAssertionPatch();
9995
patchCommonJSModuleTransformerToSupportExportStar();
10096
}
@@ -111,9 +107,7 @@ function loadModule(filepath, transpile) {
111107
.replace(__dirname, 'transpiler')
112108
.replace(/\\/g, '/')
113109
.replace(/\.\w*$/, '');
114-
data = (new traceur.NodeCompiler(
115-
extend(SELF_COMPILE_OPTIONS, { moduleName: moduleName } )
116-
)).compile(data, filepath, filepath);
110+
data = traceur.compile(data, SELF_COMPILE_OPTIONS, moduleName);
117111
}
118112

119113
('global', eval)(data);
@@ -157,30 +151,15 @@ function convertTypesToExpressionsInEs6Patch() {
157151
PureES6Transformer.prototype.transform = function() {
158152
if (!this._patched) {
159153
this._patched = true;
154+
var self = this;
160155
this.treeTransformers_.splice(0,0, function(tree) {
161-
return new TypeToExpressionTransformer(new UniqueIdentifierGenerator(), this.reporter_).transformAny(tree);
156+
return new TypeToExpressionTransformer(new UniqueIdentifierGenerator(), self.reporter_, self.options_).transformAny(tree);
162157
});
163158
}
164159
return _transform.apply(this, arguments);
165160
};
166161
}
167162

168-
// TODO(tbosch): Don't write field declarations in classes when we output to ES6.
169-
// This just patches the writer and does not support moving initializers to the constructor.
170-
// See src/codegeneration/ClassTransformer.js for how to support initializers as well.
171-
// see https://github.com/google/traceur-compiler/issues/1708
172-
function removeNonStaticFieldDeclarationsInEs6Patch() {
173-
var traceurVersion = System.map['traceur'];
174-
var ParseTreeWriter = System.get(traceurVersion+'/src/outputgeneration/ParseTreeWriter').ParseTreeWriter;
175-
var options = System.get(traceurVersion + "/src/Options.js").options;
176-
var _visitPropertyVariableDeclaration = ParseTreeWriter.prototype.visitPropertyVariableDeclaration;
177-
ParseTreeWriter.prototype.visitPropertyVariableDeclaration = function() {
178-
if (options.outputLanguage !== 'es6') {
179-
return _visitPropertyVariableDeclaration.apply(this, arguments);
180-
}
181-
};
182-
}
183-
184163
// TODO(tbosch): Disable getter/setters for assertions until traceur has a flag
185164
// that allows to disable them while keeping assertions and member fields enabled.
186165
// see https://github.com/google/traceur-compiler/issues/1625

0 commit comments

Comments
 (0)