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

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

Issue 2612273003: dart2js-kernel: do not crash on missing const initializers (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | 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) 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 'dart:collection' show Queue; 8 import 'dart:collection' show Queue;
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 return TypeMaskFactory.inferredTypeForSelector( 313 return TypeMaskFactory.inferredTypeForSelector(
314 selector, mask, _globalInferenceResults); 314 selector, mask, _globalInferenceResults);
315 } 315 }
316 316
317 TypeMask typeFromNativeBehavior( 317 TypeMask typeFromNativeBehavior(
318 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { 318 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) {
319 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); 319 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
320 } 320 }
321 321
322 ConstantValue getConstantFor(ir.Node node) { 322 ConstantValue getConstantFor(ir.Node node) {
323 // Some `null`s are not mapped when they correspond to errors, e.g. missing
324 // `const` initializers.
325 if (node is ir.NullLiteral) return new NullConstantValue();
326
323 ConstantValue constantValue = 327 ConstantValue constantValue =
324 _backend.constants.getConstantValueForNode(getNode(node), elements); 328 _backend.constants.getConstantValueForNode(getNode(node), elements);
325 assert(invariant(getNode(node), constantValue != null, 329 assert(invariant(getNode(node), constantValue != null,
326 message: 'No constant computed for $node')); 330 message: 'No constant computed for $node'));
327 return constantValue; 331 return constantValue;
328 } 332 }
329 333
330 ConstantValue getConstantForParameterDefaultValue(ir.Node defaultExpression) { 334 ConstantValue getConstantForParameterDefaultValue(ir.Node defaultExpression) {
331 // TODO(27394): Evaluate constant expressions in ir.Node domain. 335 // TODO(27394): Evaluate constant expressions in ir.Node domain.
332 // In the interim, expand the Constantifier and do this: 336 // In the interim, expand the Constantifier and do this:
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 967
964 @override 968 @override
965 String get name => null; 969 String get name => null;
966 970
967 @override 971 @override
968 int get nestingLevel => 1; 972 int get nestingLevel => 1;
969 973
970 @override 974 @override
971 ast.Node get statement => null; 975 ast.Node get statement => null;
972 } 976 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698