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

Side by Side Diff: pkg/compiler/lib/src/js_backend/namer.dart

Issue 2199593003: Add kind to ConstantValue. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 4 years, 4 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. 8 * Assigns JavaScript identifiers to Dart variables, class-names and members.
9 * 9 *
10 * Names are generated through three stages: 10 * Names are generated through three stages:
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 } 1761 }
1762 1762
1763 @override 1763 @override
1764 void visitInterceptor(InterceptorConstantValue constant, [_]) { 1764 void visitInterceptor(InterceptorConstantValue constant, [_]) {
1765 addRoot(constant.dispatchedType.element.name); 1765 addRoot(constant.dispatchedType.element.name);
1766 add('methods'); 1766 add('methods');
1767 } 1767 }
1768 1768
1769 @override 1769 @override
1770 void visitSynthetic(SyntheticConstantValue constant, [_]) { 1770 void visitSynthetic(SyntheticConstantValue constant, [_]) {
1771 switch (constant.kind) { 1771 switch (constant.valueKind) {
1772 case SyntheticConstantKind.DUMMY_INTERCEPTOR: 1772 case SyntheticConstantKind.DUMMY_INTERCEPTOR:
1773 add('dummy_receiver'); 1773 add('dummy_receiver');
1774 break; 1774 break;
1775 case SyntheticConstantKind.TYPEVARIABLE_REFERENCE: 1775 case SyntheticConstantKind.TYPEVARIABLE_REFERENCE:
1776 // Omit. These are opaque deferred indexes with nothing helpful to add. 1776 // Omit. These are opaque deferred indexes with nothing helpful to add.
1777 break; 1777 break;
1778 case SyntheticConstantKind.NAME: 1778 case SyntheticConstantKind.NAME:
1779 add('name'); 1779 add('name');
1780 break; 1780 break;
1781 default: 1781 default:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 } 1881 }
1882 1882
1883 @override 1883 @override
1884 int visitInterceptor(InterceptorConstantValue constant, [_]) { 1884 int visitInterceptor(InterceptorConstantValue constant, [_]) {
1885 String typeName = constant.dispatchedType.element.name; 1885 String typeName = constant.dispatchedType.element.name;
1886 return _hashString(5, typeName); 1886 return _hashString(5, typeName);
1887 } 1887 }
1888 1888
1889 @override 1889 @override
1890 int visitSynthetic(SyntheticConstantValue constant, [_]) { 1890 int visitSynthetic(SyntheticConstantValue constant, [_]) {
1891 switch (constant.kind) { 1891 switch (constant.valueKind) {
1892 case SyntheticConstantKind.TYPEVARIABLE_REFERENCE: 1892 case SyntheticConstantKind.TYPEVARIABLE_REFERENCE:
1893 // These contain a deferred opaque index into metadata. There is nothing 1893 // These contain a deferred opaque index into metadata. There is nothing
1894 // we can access that is stable between compiles. Luckily, since they 1894 // we can access that is stable between compiles. Luckily, since they
1895 // resolve to integer indexes, they're always part of a larger constant. 1895 // resolve to integer indexes, they're always part of a larger constant.
1896 return 0; 1896 return 0;
1897 default: 1897 default:
1898 reporter.internalError( 1898 reporter.internalError(
1899 NO_LOCATION_SPANNABLE, 1899 NO_LOCATION_SPANNABLE,
1900 'SyntheticConstantValue should never be named and ' 1900 'SyntheticConstantValue should never be named and '
1901 'never be subconstant'); 1901 'never be subconstant');
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 void addSuggestion(String original, String suggestion) { 2057 void addSuggestion(String original, String suggestion) {
2058 assert(!_suggestedNames.containsKey(original)); 2058 assert(!_suggestedNames.containsKey(original));
2059 _suggestedNames[original] = suggestion; 2059 _suggestedNames[original] = suggestion;
2060 } 2060 }
2061 2061
2062 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2062 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2063 bool isSuggestion(String candidate) { 2063 bool isSuggestion(String candidate) {
2064 return _suggestedNames.containsValue(candidate); 2064 return _suggestedNames.containsValue(candidate);
2065 } 2065 }
2066 } 2066 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/constant_ordering.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698