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

Side by Side Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2550323002: Insert default arguments for static calls and constructor calls. (Closed)
Patch Set: 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:js_runtime/shared/embedded_names.dart'; 5 import 'package:js_runtime/shared/embedded_names.dart';
6 import 'package:kernel/ast.dart' as ir; 6 import 'package:kernel/ast.dart' as ir;
7 7
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/names.dart'; 10 import '../common/names.dart';
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 ConstantValue getConstantFor(ir.Node node) { 287 ConstantValue getConstantFor(ir.Node node) {
288 ConstantValue constantValue = 288 ConstantValue constantValue =
289 _backend.constants.getConstantValueForNode(getNode(node), elements); 289 _backend.constants.getConstantValueForNode(getNode(node), elements);
290 assert(invariant(getNode(node), constantValue != null, 290 assert(invariant(getNode(node), constantValue != null,
291 message: 'No constant computed for $node')); 291 message: 'No constant computed for $node'));
292 return constantValue; 292 return constantValue;
293 } 293 }
294 294
295 ConstantValue getConstantForParameterDefaultValue(ir.Node defaultExpression) {
296 // TODO(27394): Evaluate constant expressions in ir.Node domain.
297 // In the interim, expand the Constantifier and do this:
298 //
299 // ConstantExpression constantExpression =
300 // defaultExpression.accept(new Constantifier(this));
301 // assert(constantExpression != null);
302 ConstantExpression constantExpression =
303 kernel.parameterInitializerNodeToConstant[defaultExpression];
304 if (constantExpression == null) return null;
305 return _backend.constants.getConstantValue(constantExpression);
306 }
307
295 ConstantValue getConstantForType(ir.DartType irType) { 308 ConstantValue getConstantForType(ir.DartType irType) {
296 DartType type = getDartType(irType); 309 DartType type = getDartType(irType);
297 return _backend.constantSystem.createType(_compiler, type.asRaw()); 310 return _backend.constantSystem.createType(_compiler, type.asRaw());
298 } 311 }
299 312
300 bool isIntercepted(ir.Node node) { 313 bool isIntercepted(ir.Node node) {
301 Selector selector = getSelector(node); 314 Selector selector = getSelector(node);
302 return _backend.isInterceptedSelector(selector); 315 return _backend.isInterceptedSelector(selector);
303 } 316 }
304 317
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 astAdapter.reporter.internalError( 830 astAdapter.reporter.internalError(
818 CURRENT_ELEMENT_SPANNABLE, "Unexpected constant target: $element."); 831 CURRENT_ELEMENT_SPANNABLE, "Unexpected constant target: $element.");
819 return null; 832 return null;
820 } 833 }
821 834
822 @override 835 @override
823 ConstantExpression visitStringLiteral(ir.StringLiteral node) { 836 ConstantExpression visitStringLiteral(ir.StringLiteral node) {
824 return new StringConstantExpression(node.value); 837 return new StringConstantExpression(node.value);
825 } 838 }
826 } 839 }
OLDNEW
« pkg/compiler/lib/src/ssa/builder_kernel.dart ('K') | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698