Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal implementation of Decorators #2399

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5db3b0d
Types for decorators
rbuckton Mar 17, 2015
fb7dd52
Utilities for decorators
rbuckton Mar 17, 2015
efd8a89
Diagnostics for decorators
rbuckton Mar 17, 2015
fb10deb
Scanner updates for decorators
rbuckton Mar 17, 2015
8282a0b
Parser updates for decorators
rbuckton Mar 17, 2015
39001f5
Checker updates for decorators
rbuckton Mar 17, 2015
bd4d7fc
Emit for decorators, updated to ES6 classes.
rbuckton Mar 17, 2015
f1e8e61
Updated formatting for decorators
rbuckton Mar 17, 2015
6c32a8b
Updated baselines
rbuckton Mar 17, 2015
f909c6c
Updated baselines
rbuckton Mar 17, 2015
5673400
Updated baselines
rbuckton Mar 17, 2015
ff356ce
Added sourcemap tests
rbuckton Mar 18, 2015
9761f4b
PR comment, sourcemap test
rbuckton Mar 18, 2015
0fb624a
PR feedback
rbuckton Mar 20, 2015
2078aff
Minor cleanup of resolveName for decorators
rbuckton Mar 20, 2015
299fbe3
Refactored checkDecoratorSignature and renamed getAnnotationTypeForDe…
rbuckton Mar 21, 2015
6633349
Simplified grammar check for decorators.
rbuckton Mar 21, 2015
5e241a3
Removed the (now unused) lineBreakBetween
rbuckton Mar 23, 2015
1b8933c
Renamed variables for clarity
rbuckton Mar 23, 2015
bf383b5
Simplified check for decorators.
rbuckton Mar 23, 2015
5b988cd
Some emit cleanup for ES6 classes, comments.
rbuckton Mar 23, 2015
8dd9b9f
Updated check and emit, updated baselines
rbuckton Mar 23, 2015
335d567
Comments and cleanup
rbuckton Mar 24, 2015
695c50b
Disallow decorators on multiple get/set accessors of the same name
rbuckton Mar 24, 2015
70bd582
Changed emit for decorators
rbuckton Mar 24, 2015
e6ccaf0
Updated typecheck for property, method, and parameter decorators
rbuckton Mar 24, 2015
f531193
Updates to emit and updated baselines
rbuckton Mar 25, 2015
d2a9b15
Merged branch 'master' into decorators_min
rbuckton Mar 25, 2015
e92a085
Minor rename
rbuckton Mar 25, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 5 additions & 3 deletions Jakefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var compilerSources = [
"utilities.ts",
"binder.ts",
"checker.ts",
"declarationEmitter.ts",
"emitter.ts",
"program.ts",
"commandLineParser.ts",
Expand All @@ -57,6 +58,7 @@ var servicesSources = [
"utilities.ts",
"binder.ts",
"checker.ts",
"declarationEmitter.ts",
"emitter.ts",
"program.ts",
"commandLineParser.ts",
Expand All @@ -65,7 +67,7 @@ var servicesSources = [
return path.join(compilerDirectory, f);
}).concat([
"breakpoints.ts",
"navigateTo.ts",
"navigateTo.ts",
"navigationBar.ts",
"outliningElementsCollector.ts",
"patternMatcher.ts",
Expand Down Expand Up @@ -539,7 +541,7 @@ function cleanTestDirs() {
}

jake.mkdirP(localRwcBaseline);
jake.mkdirP(localTest262Baseline);
jake.mkdirP(localTest262Baseline);
jake.mkdirP(localBaseline);
}

Expand Down Expand Up @@ -718,7 +720,7 @@ file(loggedIOJsPath, [builtLocalDirectory, loggedIOpath], function() {

var instrumenterPath = harnessDirectory + 'instrumenter.ts';
var instrumenterJsPath = builtLocalDirectory + 'instrumenter.js';
compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath], [], /*useBuiltCompiler*/ true);
compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath].concat(libraryTargets), [], /*useBuiltCompiler*/ true);

desc("Builds an instrumented tsc.js");
task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function() {
Expand Down
505 changes: 314 additions & 191 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

39 changes: 37 additions & 2 deletions src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ module ts {
}

export function addRange<T>(to: T[], from: T[]): void {
for (let v of from) {
to.push(v);
if (to && from) {
for (let v of from) {
to.push(v);
}
}
}

Expand Down Expand Up @@ -160,6 +162,39 @@ module ts {
return ~low;
}

export function reduceLeft<T>(array: T[], f: (a: T, x: T) => T): T;
export function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
export function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial?: U): U {
if (array) {
var count = array.length;
if (count > 0) {
var pos = 0;
var result = arguments.length <= 2 ? array[pos++] : initial;
while (pos < count) {
result = f(<U>result, array[pos++]);
}
return <U>result;
}
}
return initial;
}

export function reduceRight<T>(array: T[], f: (a: T, x: T) => T): T;
export function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
export function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial?: U): U {
if (array) {
var pos = array.length - 1;
if (pos >= 0) {
var result = arguments.length <= 2 ? array[pos--] : initial;
while (pos >= 0) {
result = f(<U>result, array[pos--]);
}
return <U>result;
}
}
return initial;
}

let hasOwnProperty = Object.prototype.hasOwnProperty;

export function hasProperty<T>(map: Map<T>, key: string): boolean {
Expand Down
Loading