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

Side by Side Diff: lib/src/codegen/js_codegen.dart

Issue 1145283002: Use short array syntax in method signatures (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dev_compiler.src.codegen.js_codegen; 5 library dev_compiler.src.codegen.js_codegen;
6 6
7 import 'dart:collection' show HashSet, HashMap; 7 import 'dart:collection' show HashSet, HashMap;
8 8
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator;
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 var tMethods = []; 588 var tMethods = [];
589 var sNames = []; 589 var sNames = [];
590 var cType = classElem.type; 590 var cType = classElem.type;
591 for (MethodDeclaration node in methods) { 591 for (MethodDeclaration node in methods) {
592 if (!(node.isSetter || node.isGetter || node.isAbstract)) { 592 if (!(node.isSetter || node.isGetter || node.isAbstract)) {
593 var name = node.name.name; 593 var name = node.name.name;
594 var element = node.element; 594 var element = node.element;
595 var unary = node.parameters.parameters.isEmpty; 595 var unary = node.parameters.parameters.isEmpty;
596 var memberName = _emitMemberName(name, 596 var memberName = _emitMemberName(name,
597 type: cType, unary: unary, isStatic: node.isStatic); 597 type: cType, unary: unary, isStatic: node.isStatic);
598 var parts = _emitFunctionTypeParts(element.type);
598 var property = 599 var property =
599 new JS.Property(memberName, _emitTypeName(element.type)); 600 new JS.Property(memberName, new JS.ArrayInitializer(parts));
600 if (node.isStatic) { 601 if (node.isStatic) {
601 tStatics.add(property); 602 tStatics.add(property);
602 sNames.add(memberName); 603 sNames.add(memberName);
603 } else tMethods.add(property); 604 } else tMethods.add(property);
604 } 605 }
605 } 606 }
606 build(name, elements) { 607 build(name, elements) {
607 var o = 608 var o =
608 new JS.ObjectInitializer(elements, vertical: elements.length > 1); 609 new JS.ObjectInitializer(elements, vertical: elements.length > 1);
609 var e = js.call('() => #', o); 610 var e = js.call('() => #', o);
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 2577
2577 /// A special kind of element created by the compiler, signifying a temporary 2578 /// A special kind of element created by the compiler, signifying a temporary
2578 /// variable. These objects use instance equality, and should be shared 2579 /// variable. These objects use instance equality, and should be shared
2579 /// everywhere in the tree where they are treated as the same variable. 2580 /// everywhere in the tree where they are treated as the same variable.
2580 class TemporaryVariableElement extends LocalVariableElementImpl { 2581 class TemporaryVariableElement extends LocalVariableElementImpl {
2581 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); 2582 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name);
2582 2583
2583 int get hashCode => identityHashCode(this); 2584 int get hashCode => identityHashCode(this);
2584 bool operator ==(Object other) => identical(this, other); 2585 bool operator ==(Object other) => identical(this, other);
2585 } 2586 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698