Skip to content

Commit 7c52aaa

Browse files
author
Yui T
committed
Merge branch 'master' into completionListWithLocalName
Conflicts: src/compiler/checker.ts
2 parents 6da98ce + 71c6433 commit 7c52aaa

File tree

536 files changed

+11327
-2046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

536 files changed

+11327
-2046
lines changed

Jakefile.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,3 +715,9 @@ task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function
715715
});
716716
ex.run();
717717
}, { async: true });
718+
719+
desc("Updates the sublime plugin's tsserver");
720+
task("update-sublime", [serverFile], function() {
721+
jake.cpR(serverFile, "../TypeScript-Sublime-Plugin/tsserver/");
722+
jake.cpR(serverFile + ".map", "../TypeScript-Sublime-Plugin/tsserver/");
723+
});

scripts/errorCheck.ts

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,84 +4,84 @@ let async = require('async');
44
let glob = require('glob');
55

66
fs.readFile('src/compiler/diagnosticMessages.json', 'utf-8', (err, data) => {
7-
if (err) {
8-
throw err;
9-
}
10-
11-
let messages = JSON.parse(data);
12-
let keys = Object.keys(messages);
13-
console.log('Loaded ' + keys.length + ' errors');
7+
if (err) {
8+
throw err;
9+
}
1410

15-
for (let k of keys) {
16-
messages[k]['seen'] = false;
17-
}
11+
let messages = JSON.parse(data);
12+
let keys = Object.keys(messages);
13+
console.log('Loaded ' + keys.length + ' errors');
1814

19-
let errRegex = /\(\d+,\d+\): error TS([^:]+):/g;
15+
for (let k of keys) {
16+
messages[k]['seen'] = false;
17+
}
2018

21-
let baseDir = 'tests/baselines/reference/';
22-
fs.readdir(baseDir, (err, files) => {
23-
files = files.filter(f => f.indexOf('.errors.txt') > 0);
24-
let tasks: Array<(callback: () => void) => void> = [];
25-
files.forEach(f => tasks.push(done => {
26-
fs.readFile(baseDir + f, 'utf-8', (err, baseline) => {
27-
if (err) throw err;
19+
let errRegex = /\(\d+,\d+\): error TS([^:]+):/g;
2820

29-
let g: string[];
30-
while (g = errRegex.exec(baseline)) {
31-
var errCode = +g[1];
32-
let msg = keys.filter(k => messages[k].code === errCode)[0];
33-
messages[msg]['seen'] = true;
34-
}
21+
let baseDir = 'tests/baselines/reference/';
22+
fs.readdir(baseDir, (err, files) => {
23+
files = files.filter(f => f.indexOf('.errors.txt') > 0);
24+
let tasks: Array<(callback: () => void) => void> = [];
25+
files.forEach(f => tasks.push(done => {
26+
fs.readFile(baseDir + f, 'utf-8', (err, baseline) => {
27+
if (err) throw err;
3528

36-
done();
37-
});
38-
}));
29+
let g: string[];
30+
while (g = errRegex.exec(baseline)) {
31+
var errCode = +g[1];
32+
let msg = keys.filter(k => messages[k].code === errCode)[0];
33+
messages[msg]['seen'] = true;
34+
}
3935

40-
async.parallelLimit(tasks, 25, done => {
41-
console.log('== List of errors not present in baselines ==');
42-
let count = 0;
43-
for (let k of keys) {
44-
if (messages[k]['seen'] !== true) {
45-
console.log(k);
46-
count++;
47-
}
48-
}
49-
console.log(count + ' of ' + keys.length + ' errors are not in baselines');
50-
});
51-
});
36+
done();
37+
});
38+
}));
39+
40+
async.parallelLimit(tasks, 25, done => {
41+
console.log('== List of errors not present in baselines ==');
42+
let count = 0;
43+
for (let k of keys) {
44+
if (messages[k]['seen'] !== true) {
45+
console.log(k);
46+
count++;
47+
}
48+
}
49+
console.log(count + ' of ' + keys.length + ' errors are not in baselines');
50+
});
51+
});
5252
});
5353

5454
fs.readFile('src/compiler/diagnosticInformationMap.generated.ts', 'utf-8', (err, data) => {
55-
let errorRegexp = /\s(\w+): \{ code/g;
56-
let errorNames: string[] = [];
57-
let errMatch: string[];
58-
while (errMatch = errorRegexp.exec(data)) {
59-
errorNames.push(errMatch[1]);
60-
}
55+
let errorRegexp = /\s(\w+): \{ code/g;
56+
let errorNames: string[] = [];
57+
let errMatch: string[];
58+
while (errMatch = errorRegexp.exec(data)) {
59+
errorNames.push(errMatch[1]);
60+
}
6161

62-
let allSrc: string = '';
63-
glob('./src/**/*.ts', {}, (err, files) => {
64-
console.log('Reading ' + files.length + ' source files');
65-
for(let file of files) {
66-
if (file.indexOf('diagnosticInformationMap.generated.ts') > 0) {
67-
continue;
68-
}
62+
let allSrc: string = '';
63+
glob('./src/**/*.ts', {}, (err, files) => {
64+
console.log('Reading ' + files.length + ' source files');
65+
for (let file of files) {
66+
if (file.indexOf('diagnosticInformationMap.generated.ts') > 0) {
67+
continue;
68+
}
6969

70-
let src = fs.readFileSync(file, 'utf-8');
71-
allSrc = allSrc + src;
72-
}
70+
let src = fs.readFileSync(file, 'utf-8');
71+
allSrc = allSrc + src;
72+
}
7373

74-
console.log('Consumed ' + allSrc.length + ' characters of source');
74+
console.log('Consumed ' + allSrc.length + ' characters of source');
7575

76-
let count = 0;
77-
console.log('== List of errors not used in source ==')
78-
for(let errName of errorNames) {
79-
if (allSrc.indexOf(errName) < 0) {
80-
console.log(errName);
81-
count++;
82-
}
83-
}
84-
console.log(count + ' of ' + errorNames.length + ' errors are not used in source');
85-
});
76+
let count = 0;
77+
console.log('== List of errors not used in source ==')
78+
for (let errName of errorNames) {
79+
if (allSrc.indexOf(errName) < 0) {
80+
console.log(errName);
81+
count++;
82+
}
83+
}
84+
console.log(count + ' of ' + errorNames.length + ' errors are not used in source');
85+
});
8686
});
8787

src/compiler/binder.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ namespace ts {
173173
return node.name ? declarationNameToString(node.name) : getDeclarationName(node);
174174
}
175175

176+
/**
177+
* Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
178+
* @param symbolTable - The symbol table which node will be added to.
179+
* @param parent - node's parent declaration.
180+
* @param node - The declaration to be added to the symbol table
181+
* @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.)
182+
* @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations.
183+
*/
176184
function declareSymbol(symbolTable: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
177185
Debug.assert(!hasDynamicName(node));
178186

@@ -181,10 +189,11 @@ namespace ts {
181189

182190
let symbol: Symbol;
183191
if (name !== undefined) {
192+
184193
// Check and see if the symbol table already has a symbol with this name. If not,
185194
// create a new symbol with this name and add it to the table. Note that we don't
186195
// give the new symbol any flags *yet*. This ensures that it will not conflict
187-
// witht he 'excludes' flags we pass in.
196+
// with the 'excludes' flags we pass in.
188197
//
189198
// If we do get an existing symbol, see if it conflicts with the new symbol we're
190199
// creating. For example, a 'var' symbol and a 'class' symbol will conflict within
@@ -202,10 +211,10 @@ namespace ts {
202211
symbol = hasProperty(symbolTable, name)
203212
? symbolTable[name]
204213
: (symbolTable[name] = createSymbol(SymbolFlags.None, name));
205-
214+
206215
if (name && (includes & SymbolFlags.Classifiable)) {
207-
classifiableNames[name] = name;
208-
}
216+
classifiableNames[name] = name;
217+
}
209218

210219
if (symbol.flags & excludes) {
211220
if (node.name) {
@@ -314,6 +323,7 @@ namespace ts {
314323

315324
addToContainerChain(container);
316325
}
326+
317327
else if (containerFlags & ContainerFlags.IsBlockScopedContainer) {
318328
blockScopeContainer = node;
319329
blockScopeContainer.locals = undefined;

0 commit comments

Comments
 (0)