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

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

Issue 1559233002: WIP: Compute constant expressions in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 void visitFunction(FunctionConstantValue constant, [_]) { 1643 void visitFunction(FunctionConstantValue constant, [_]) {
1644 add(constant.element.name); 1644 add(constant.element.name);
1645 } 1645 }
1646 1646
1647 @override 1647 @override
1648 void visitNull(NullConstantValue constant, [_]) { 1648 void visitNull(NullConstantValue constant, [_]) {
1649 add('null'); 1649 add('null');
1650 } 1650 }
1651 1651
1652 @override 1652 @override
1653 void visitNonConstant(NonConstantValue constant, [_]) {
1654 add('null');
1655 }
1656
1657 @override
1653 void visitInt(IntConstantValue constant, [_]) { 1658 void visitInt(IntConstantValue constant, [_]) {
1654 // No `addRoot` since IntConstants are always inlined. 1659 // No `addRoot` since IntConstants are always inlined.
1655 if (constant.primitiveValue < 0) { 1660 if (constant.primitiveValue < 0) {
1656 add('m${-constant.primitiveValue}'); 1661 add('m${-constant.primitiveValue}');
1657 } else { 1662 } else {
1658 add('${constant.primitiveValue}'); 1663 add('${constant.primitiveValue}');
1659 } 1664 }
1660 } 1665 }
1661 1666
1662 @override 1667 @override
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 hash = _finish(constant.accept(this, null)); 1793 hash = _finish(constant.accept(this, null));
1789 hashes[constant] = hash; 1794 hashes[constant] = hash;
1790 } 1795 }
1791 return hash; 1796 return hash;
1792 } 1797 }
1793 1798
1794 @override 1799 @override
1795 int visitNull(NullConstantValue constant, [_]) => 1; 1800 int visitNull(NullConstantValue constant, [_]) => 1;
1796 1801
1797 @override 1802 @override
1803 int visitNonConstant(NonConstantValue constant, [_]) => 1;
1804
1805 @override
1798 int visitBool(BoolConstantValue constant, [_]) { 1806 int visitBool(BoolConstantValue constant, [_]) {
1799 return constant.isTrue ? 2 : 3; 1807 return constant.isTrue ? 2 : 3;
1800 } 1808 }
1801 1809
1802 @override 1810 @override
1803 int visitFunction(FunctionConstantValue constant, [_]) { 1811 int visitFunction(FunctionConstantValue constant, [_]) {
1804 return _hashString(1, constant.element.name); 1812 return _hashString(1, constant.element.name);
1805 } 1813 }
1806 1814
1807 @override 1815 @override
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 } 2009 }
2002 } 2010 }
2003 } 2011 }
2004 } 2012 }
2005 2013
2006 enum NamingScope { 2014 enum NamingScope {
2007 global, 2015 global,
2008 instance, 2016 instance,
2009 constant 2017 constant
2010 } 2018 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_system_javascript.dart ('k') | pkg/compiler/lib/src/resolution/constructors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698