| OLD | NEW |
| 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 '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../compiler.dart'; | 9 import '../compiler.dart'; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 370 |
| 371 TypeMask get traceFromExceptionType => | 371 TypeMask get traceFromExceptionType => |
| 372 TypeMaskFactory.inferredReturnTypeForElement( | 372 TypeMaskFactory.inferredReturnTypeForElement( |
| 373 _backend.helpers.traceFromException, _globalInferenceResults); | 373 _backend.helpers.traceFromException, _globalInferenceResults); |
| 374 | 374 |
| 375 ir.Procedure get streamIteratorConstructor => | 375 ir.Procedure get streamIteratorConstructor => |
| 376 kernel.functions[_backend.helpers.streamIteratorConstructor]; | 376 kernel.functions[_backend.helpers.streamIteratorConstructor]; |
| 377 | 377 |
| 378 TypeMask get streamIteratorConstructorType => | 378 TypeMask get streamIteratorConstructorType => |
| 379 TypeMaskFactory.inferredReturnTypeForElement( | 379 TypeMaskFactory.inferredReturnTypeForElement( |
| 380 _backend.helpers.streamIteratorConstructor, _globalInferenceResults); | 380 _backend.helpers.streamIteratorConstructor as FunctionEntity, |
| 381 _globalInferenceResults); |
| 381 | 382 |
| 382 ir.Procedure get fallThroughError => | 383 ir.Procedure get fallThroughError => |
| 383 kernel.functions[_backend.helpers.fallThroughError]; | 384 kernel.functions[_backend.helpers.fallThroughError]; |
| 384 | 385 |
| 385 TypeMask get fallThroughErrorType => | 386 TypeMask get fallThroughErrorType => |
| 386 TypeMaskFactory.inferredReturnTypeForElement( | 387 TypeMaskFactory.inferredReturnTypeForElement( |
| 387 _backend.helpers.fallThroughError, _globalInferenceResults); | 388 _backend.helpers.fallThroughError, _globalInferenceResults); |
| 388 | 389 |
| 389 ir.Procedure get mapLiteralUntypedMaker => | 390 ir.Procedure get mapLiteralUntypedMaker => |
| 390 kernel.functions[_backend.helpers.mapLiteralUntypedMaker]; | 391 kernel.functions[_backend.helpers.mapLiteralUntypedMaker]; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 477 } |
| 477 | 478 |
| 478 js.Template getJsBuiltinTemplate(ConstantValue constant) { | 479 js.Template getJsBuiltinTemplate(ConstantValue constant) { |
| 479 int index = _extractEnumIndexFromConstantValue( | 480 int index = _extractEnumIndexFromConstantValue( |
| 480 constant, _backend.helpers.jsBuiltinEnum); | 481 constant, _backend.helpers.jsBuiltinEnum); |
| 481 if (index == null) return null; | 482 if (index == null) return null; |
| 482 return _backend.emitter.builtinTemplateFor(JsBuiltin.values[index]); | 483 return _backend.emitter.builtinTemplateFor(JsBuiltin.values[index]); |
| 483 } | 484 } |
| 484 | 485 |
| 485 int _extractEnumIndexFromConstantValue( | 486 int _extractEnumIndexFromConstantValue( |
| 486 ConstantValue constant, Element classElement) { | 487 ConstantValue constant, ClassEntity classElement) { |
| 487 if (constant is ConstructedConstantValue) { | 488 if (constant is ConstructedConstantValue) { |
| 488 if (constant.type.element == classElement) { | 489 if (constant.type.element == classElement) { |
| 489 assert(constant.fields.length == 1); | 490 assert(constant.fields.length == 1); |
| 490 ConstantValue indexConstant = constant.fields.values.single; | 491 ConstantValue indexConstant = constant.fields.values.single; |
| 491 if (indexConstant is IntConstantValue) { | 492 if (indexConstant is IntConstantValue) { |
| 492 return indexConstant.primitiveValue; | 493 return indexConstant.primitiveValue; |
| 493 } | 494 } |
| 494 } | 495 } |
| 495 } | 496 } |
| 496 return null; | 497 return null; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 JumpTarget continueTarget = | 819 JumpTarget continueTarget = |
| 819 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); | 820 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); |
| 820 assert(continueTarget is KernelJumpTarget); | 821 assert(continueTarget is KernelJumpTarget); |
| 821 targetIndexMap[continueTarget] = switchIndex; | 822 targetIndexMap[continueTarget] = switchIndex; |
| 822 assert(builder.jumpTargets[continueTarget] == null); | 823 assert(builder.jumpTargets[continueTarget] == null); |
| 823 builder.jumpTargets[continueTarget] = this; | 824 builder.jumpTargets[continueTarget] = this; |
| 824 switchIndex++; | 825 switchIndex++; |
| 825 } | 826 } |
| 826 } | 827 } |
| 827 } | 828 } |
| OLD | NEW |