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

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map_impl.dart

Issue 2916393002: Compute constants from IR nodes (Closed)
Patch Set: Updated cf. comments Created 3 years, 6 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 dart2js.kernel.element_map; 5 library dart2js.kernel.element_map;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 import 'package:kernel/clone.dart'; 8 import 'package:kernel/clone.dart';
9 import 'package:kernel/type_algebra.dart'; 9 import 'package:kernel/type_algebra.dart';
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ElementEnvironment get elementEnvironment => _elementEnvironment; 123 ElementEnvironment get elementEnvironment => _elementEnvironment;
124 124
125 ConstantEnvironment get constantEnvironment => _constantEnvironment; 125 ConstantEnvironment get constantEnvironment => _constantEnvironment;
126 126
127 DartTypes get types => _types; 127 DartTypes get types => _types;
128 128
129 @override 129 @override
130 native.BehaviorBuilder get nativeBehaviorBuilder => _nativeBehaviorBuilder; 130 native.BehaviorBuilder get nativeBehaviorBuilder => _nativeBehaviorBuilder;
131 131
132 @override 132 @override
133 ConstantValue computeConstantValue(ConstantExpression constant) { 133 ConstantValue computeConstantValue(ConstantExpression constant,
134 {bool requireConstant: true}) {
134 return _constantEnvironment.getConstantValue(constant); 135 return _constantEnvironment.getConstantValue(constant);
135 } 136 }
136 137
137 LibraryEntity lookupLibrary(Uri uri) { 138 LibraryEntity lookupLibrary(Uri uri) {
138 _KLibraryEnv libraryEnv = _env.lookupLibrary(uri); 139 _KLibraryEnv libraryEnv = _env.lookupLibrary(uri);
139 if (libraryEnv == null) return null; 140 if (libraryEnv == null) return null;
140 return _getLibrary(libraryEnv.library, libraryEnv); 141 return _getLibrary(libraryEnv.library, libraryEnv);
141 } 142 }
142 143
143 KLibrary _getLibrary(ir.Library node, [_KLibraryEnv libraryEnv]) { 144 KLibrary _getLibrary(ir.Library node, [_KLibraryEnv libraryEnv]) {
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 return node.isExternal && 1548 return node.isExternal &&
1548 !elementMap.isForeignLibrary(node.enclosingLibrary); 1549 !elementMap.isForeignLibrary(node.enclosingLibrary);
1549 } 1550 }
1550 1551
1551 @override 1552 @override
1552 bool isJsInteropMember(MemberEntity element) { 1553 bool isJsInteropMember(MemberEntity element) {
1553 // TODO(johnniwinther): Compute this. 1554 // TODO(johnniwinther): Compute this.
1554 return false; 1555 return false;
1555 } 1556 }
1556 } 1557 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698