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

Side by Side Diff: pkg/compiler/lib/src/dart_types.dart

Issue 2565413002: Fix rti encoding of generic methods (Closed)
Patch Set: Add comment. Created 4 years 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart_types; 5 library dart_types;
6 6
7 import 'dart:math' show min; 7 import 'dart:math' show min;
8 8
9 import 'common/resolution.dart' show Resolution; 9 import 'common/resolution.dart' show Resolution;
10 import 'common.dart'; 10 import 'common.dart';
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 }); 1427 });
1428 // Use the new List only if necessary. 1428 // Use the new List only if necessary.
1429 return changed ? result : types; 1429 return changed ? result : types;
1430 } 1430 }
1431 1431
1432 /** 1432 /**
1433 * Returns the [ClassElement] which declares the type variables occurring in 1433 * Returns the [ClassElement] which declares the type variables occurring in
1434 * [type], or [:null:] if [type] does not contain type variables. 1434 * [type], or [:null:] if [type] does not contain type variables.
1435 */ 1435 */
1436 static ClassElement getClassContext(DartType type) { 1436 static ClassElement getClassContext(DartType type) {
1437 TypeVariableType typeVariable = type.typeVariableOccurrence; 1437 ClassElement contextClass;
1438 if (typeVariable == null) return null; 1438 type.forEachTypeVariable((TypeVariableType typeVariable) {
1439 if (typeVariable.element.typeDeclaration is! ClassElement) return;
1440 contextClass = typeVariable.element.typeDeclaration;
1441 });
1439 // GENERIC_METHODS: When generic method support is complete enough to 1442 // GENERIC_METHODS: When generic method support is complete enough to
1440 // include a runtime value for method type variables this must be updated. 1443 // include a runtime value for method type variables this must be updated.
1441 // For full support the global assumption that all type variables are 1444 // For full support the global assumption that all type variables are
1442 // declared by the same enclosing class will not hold: Both an enclosing 1445 // declared by the same enclosing class will not hold: Both an enclosing
1443 // method and an enclosing class may define type variables, so the return 1446 // method and an enclosing class may define type variables, so the return
1444 // type cannot be [ClassElement] and the caller must be prepared to look in 1447 // type cannot be [ClassElement] and the caller must be prepared to look in
1445 // two locations, not one. Currently we ignore method type variables by 1448 // two locations, not one. Currently we ignore method type variables by
1446 // returning in the next statement. 1449 // returning in the next statement.
1447 if (typeVariable.element.typeDeclaration is! ClassElement) return null; 1450 return contextClass;
1448 return typeVariable.element.typeDeclaration;
1449 } 1451 }
1450 1452
1451 /** 1453 /**
1452 * A `compareTo` function that globally orders types using 1454 * A `compareTo` function that globally orders types using
1453 * [Elements.compareByPosition] to order types defined by a declaration. 1455 * [Elements.compareByPosition] to order types defined by a declaration.
1454 * 1456 *
1455 * The order is: 1457 * The order is:
1456 * * void 1458 * * void
1457 * * dynamic 1459 * * dynamic
1458 * * interface, typedef, type variables ordered by element order 1460 * * interface, typedef, type variables ordered by element order
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 sb.write(', '); 2021 sb.write(', ');
2020 } 2022 }
2021 namedParameterTypes[index].accept(this, namedParameters[index]); 2023 namedParameterTypes[index].accept(this, namedParameters[index]);
2022 needsComma = true; 2024 needsComma = true;
2023 } 2025 }
2024 sb.write('}'); 2026 sb.write('}');
2025 } 2027 }
2026 sb.write(')'); 2028 sb.write(')');
2027 } 2029 }
2028 } 2030 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698