File: parserRealSource4.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (304 lines) | stat: -rw-r--r-- 11,379 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
tests/cases/conformance/parser/ecmascript5/parserRealSource4.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found.
tests/cases/conformance/parser/ecmascript5/parserRealSource4.ts(195,37): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.


==== tests/cases/conformance/parser/ecmascript5/parserRealSource4.ts (2 errors) ====
    // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. 
    // See LICENSE.txt in the project root for complete license information.
    
    ///<reference path='typescript.ts' />
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found.
    
    module TypeScript {
    
        export class BlockIntrinsics {
            public prototype = undefined;
            public toString = undefined;
            public toLocaleString = undefined;
            public valueOf = undefined;
            public hasOwnProperty = undefined;
            public propertyIsEnumerable = undefined;
            public isPrototypeOf = undefined;
    
            constructor () {
                // initialize the 'constructor' field
                this["constructor"] = undefined;
            }
        }
    
        export interface IHashTable {
            getAllKeys(): string[];
            add(key: string, data): boolean;
            addOrUpdate(key: string, data): boolean;
            map(fn: (k: string, v, c) => void , context): void;
            every(fn: (k: string, v, c) => boolean, context): boolean;
            some(fn: (k: string, v, c) => boolean, context): boolean;
            count(): number;
            lookup(key: string): any;
        }
    
        export class StringHashTable implements IHashTable {
            public itemCount = 0;
            public table = <any>(<any> new BlockIntrinsics());
    
            public getAllKeys(): string[]{
                var result: string[] = [];
                for (var k in this.table) {
                    if (this.table[k] != undefined) {
                        result[result.length] = k;
                    }
                }
                return result;
            }
    
            public add(key: string, data): boolean {
                if (this.table[key] != undefined) {
                    return false;
                }
                this.table[key] = data;
                this.itemCount++;
                return true;
            }
    
            public addOrUpdate(key: string, data): boolean {
                if (this.table[key] != undefined) {
                    this.table[key] = data;
                    return false;
                }
                this.table[key] = data;
                this.itemCount++;
                return true;
            }
    
            public map(fn: (k: string, v, c) => void , context) {
                for (var k in this.table) {
                    var data = this.table[k];
                    if (data != undefined) {
                        fn(k, this.table[k], context);
                    }
                }
            }
    
            public every(fn: (k: string, v, c) => boolean, context) {
                for (var k in this.table) {
                    var data = this.table[k];
                    if (data != undefined) {
                        if (!fn(k, this.table[k], context)) {
                            return false;
                        }
                    }
                }
                return true;
            }
    
            public some(fn: (k: string, v, c) => boolean, context) {
                for (var k in this.table) {
                    var data = this.table[k];
                    if (data != undefined) {
                        if (fn(k, this.table[k], context)) {
                            return true;
                        }
                    }
                }
                return false;
            }
    
            public count(): number { return this.itemCount; }
    
            public lookup(key: string) {
                var data = this.table[key];
                if (data != undefined) {
                    return data;
                }
                else {
                    return (null);
                }
            }
        }
    
        // The resident table is expected to reference the same table object, whereas the 
        // transientTable may reference different objects over time
        // REVIEW:  WARNING:  For performance reasons, neither the primary nor secondary table may be null
        export class DualStringHashTable implements IHashTable {
    
            public insertPrimary = true;
    
            constructor (public primaryTable: IHashTable,
                                            public secondaryTable: IHashTable) { }
    
            public getAllKeys(): string[]{
                return this.primaryTable.getAllKeys().concat(this.secondaryTable.getAllKeys());
            }
    
            public add(key: string, data): boolean {
                if (this.insertPrimary) {
                    return this.primaryTable.add(key, data);
                }
                else {
                    return this.secondaryTable.add(key, data);
                }
            }
    
            public addOrUpdate(key: string, data): boolean {
                if (this.insertPrimary) {
                    return this.primaryTable.addOrUpdate(key, data);
                }
                else {
                    return this.secondaryTable.addOrUpdate(key, data);
                }
            }
    
            public map(fn: (k: string, v, c) => void , context) {
                this.primaryTable.map(fn, context);
                this.secondaryTable.map(fn, context);
            }
    
            public every(fn: (k: string, v, c) => boolean, context) {
                return this.primaryTable.every(fn, context) && this.secondaryTable.every(fn, context);
            }
    
            public some(fn: (k: string, v, c) => boolean, context) {
                return this.primaryTable.some(fn, context) || this.secondaryTable.some(fn, context);
            }
    
            public count() {
                return this.primaryTable.count() + this.secondaryTable.count();
            }
    
            public lookup(key: string) {
                var data = this.primaryTable.lookup(key);
                if (data != undefined) {
                    return data;
                }
                else {
                    return this.secondaryTable.lookup(key);
                }
            }
        }
    
        export function numberHashFn(key: number): number {
            var c2 = 0x27d4eb2d; // a prime or an odd constant
            key = (key ^ 61) ^ (key >>> 16);
            key = key + (key << 3);
            key = key ^ (key >>> 4);
            key = key * c2;
            key = key ^ (key >>> 15);
            return key;
        }
    
        export function combineHashes(key1: number, key2: number) {
            return key2 ^ ((key1 >> 5) + key1);
        }
    
        export class HashEntry {
            public next: HashEntry;
    
            constructor (public key, public data) { }
        }
    
        export class HashTable {
            public itemCount: number = 0;
            public table = new HashEntry[];
                                        ~~
!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.
    
            constructor (public size: number, public hashFn: (key) =>number,
                        public equalsFn: (key1, key2) =>boolean) {
                for (var i: number = 0; i < this.size; i++) {
                    this.table[i] = null;
                }
            }
    
            public add(key, data): boolean {
                var current: HashEntry;
                var entry: HashEntry = new HashEntry(key, data);
                var val: number = this.hashFn(key);
                val = val % this.size;
    
                for (current = this.table[val]; current != null ; current = current.next) {
                    if (this.equalsFn(key, current.key)) {
                        return false;
                    }
                }
                entry.next = this.table[val];
                this.table[val] = entry;
                this.itemCount++;
                return true;
            }
    
            public remove(key) {
                var current: HashEntry;
                var val: number = this.hashFn(key);
                val = val % this.size;
                var result = null;
                var prevEntry: HashEntry = null;
    
                for (current = this.table[val]; current != null ; current = current.next) {
                    if (this.equalsFn(key, current.key)) {
                        result = current.data;
                        this.itemCount--;
                        if (prevEntry) {
                            prevEntry.next = current.next;
                        }
                        else {
                            this.table[val] = current.next;
                        }
                        break;
                    }
                    prevEntry = current;
                }
                return result;
            }
    
            public count(): number { return this.itemCount; }
    
            public lookup(key) {
                var current: HashEntry;
                var val: number = this.hashFn(key);
                val = val % this.size;
                for (current = this.table[val]; current != null ; current = current.next) {
                    if (this.equalsFn(key, current.key)) {
                        return (current.data);
                    }
                }
                return (null);
            }
        }
    
        // Simple Hash table with list of keys and values matching each other at the given index
        export class SimpleHashTable {
            private keys = [];
            private values = [];
    
            public lookup(key, findValue?: boolean) {
                var searchArray = this.keys;
                if (findValue) {
                    searchArray = this.values;
                }
    
                for (var i = 0; i < searchArray.length; i++) {
                    if (searchArray[i] == key) {
                        return {
                            key: this.keys[i],
                            data: this.values[i],
                        };
                    }
                }
                return null;
            }
    
            public add(key, data): boolean {
                var lookupData = this.lookup(key);
                if (lookupData) {
                    return false;
                }
    
                this.keys[this.keys.length] = key;
                this.values[this.values.length] = data;
    
                return true;
            }
        }
    
    }