Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: lib/declaration.ts

Issue 2416003003: Update package name, update and lock clang-format and tslint versions, and format all source files … (Closed)
Patch Set: Use ES6 Map and Set instead of Object literals to avoid ordering instability across different Node … Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/base.ts ('k') | lib/facade_converter.ts » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/declaration.ts
diff --git a/lib/declaration.ts b/lib/declaration.ts
index c20d62b8067a1d42a168e781bdf492e994e06652..a3acb8e445576dcbc92395a33a6e90990ac76599 100644
--- a/lib/declaration.ts
+++ b/lib/declaration.ts
@@ -29,7 +29,7 @@ export default class DeclarationTranspiler extends base.TranspilerBase {
this.fc = fc;
}
- getJsPath(node: ts.Node, suppressUnneededPaths = true): string {
+ getJsPath(node: ts.Node, suppressUnneededPaths: boolean): string {
let path: Array<String> = [];
let moduleDecl =
base.getAncestor(node, ts.SyntaxKind.ModuleDeclaration) as ts.ModuleDeclaration;
@@ -108,7 +108,7 @@ export default class DeclarationTranspiler extends base.TranspilerBase {
this.emit('@JS()');
return;
}
- let name: String = this.getJsPath(node);
+ let name: String = this.getJsPath(node, true);
this.emit('@JS(');
if (name.length > 0) {
this.emit('"' + name + '"');
@@ -249,7 +249,7 @@ export default class DeclarationTranspiler extends base.TranspilerBase {
visitMergingOverloads(members: Array<ts.Node>) {
// TODO(jacobr): merge method overloads.
- let groups: {[name: string]: Array<ts.Node>} = {};
+ let groups: Map<string, Array<ts.Node>> = new Map();
let orderedGroups: Array<Array<ts.Node>> = [];
members.forEach((node) => {
let name = '';
@@ -309,11 +309,11 @@ export default class DeclarationTranspiler extends base.TranspilerBase {
return;
}
let group: Array<ts.Node>;
- if (Object.prototype.hasOwnProperty.call(groups, name)) {
- group = groups[name];
+ if (groups.has(name)) {
+ group = groups.get(name);
} else {
group = [];
- groups[name] = group;
+ groups.set(name, group);
orderedGroups.push(group);
}
group.push(node);
@@ -777,7 +777,8 @@ export default class DeclarationTranspiler extends base.TranspilerBase {
* In the special case of property parameters in a constructor, we also allow a parameter to be
* emitted as a property.
*/
- private visitProperty(decl: ts.PropertyDeclaration|ts.ParameterDeclaration, isParameter = false) {
+ private visitProperty(
+ decl: ts.PropertyDeclaration|ts.ParameterDeclaration, isParameter?: boolean) {
let isStatic = base.isStatic(decl);
this.emit('external');
if (isStatic) this.emit('static');
« no previous file with comments | « lib/base.ts ('k') | lib/facade_converter.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698