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

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

Issue 1144303003: Use signature inheritance when method types are unchanged (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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // Emit the signature on the class recording the runtime type information 585 // Emit the signature on the class recording the runtime type information
586 { 586 {
587 var tStatics = []; 587 var tStatics = [];
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 inheritedElement =
596 classElem.lookUpInheritedConcreteMethod(name, currentLibrary);
597 if (inheritedElement != null &&
598 inheritedElement.type == element.type) continue;
595 var unary = node.parameters.parameters.isEmpty; 599 var unary = node.parameters.parameters.isEmpty;
596 var memberName = _emitMemberName(name, 600 var memberName = _emitMemberName(name,
597 type: cType, unary: unary, isStatic: node.isStatic); 601 type: cType, unary: unary, isStatic: node.isStatic);
598 var property = 602 var property =
599 new JS.Property(memberName, _emitTypeName(element.type)); 603 new JS.Property(memberName, _emitTypeName(element.type));
600 if (node.isStatic) { 604 if (node.isStatic) {
601 tStatics.add(property); 605 tStatics.add(property);
602 sNames.add(memberName); 606 sNames.add(memberName);
603 } else tMethods.add(property); 607 } else tMethods.add(property);
604 } 608 }
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 2580
2577 /// A special kind of element created by the compiler, signifying a temporary 2581 /// A special kind of element created by the compiler, signifying a temporary
2578 /// variable. These objects use instance equality, and should be shared 2582 /// variable. These objects use instance equality, and should be shared
2579 /// everywhere in the tree where they are treated as the same variable. 2583 /// everywhere in the tree where they are treated as the same variable.
2580 class TemporaryVariableElement extends LocalVariableElementImpl { 2584 class TemporaryVariableElement extends LocalVariableElementImpl {
2581 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); 2585 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name);
2582 2586
2583 int get hashCode => identityHashCode(this); 2587 int get hashCode => identityHashCode(this);
2584 bool operator ==(Object other) => identical(this, other); 2588 bool operator ==(Object other) => identical(this, other);
2585 } 2589 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698