| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
| 8 | 8 |
| 9 import '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 reporter.internalError(target, 'Unexpected element kind $target.'); | 294 reporter.internalError(target, 'Unexpected element kind $target.'); |
| 295 } | 295 } |
| 296 assert(result.isValid()); | 296 assert(result.isValid()); |
| 297 return result; | 297 return result; |
| 298 } | 298 } |
| 299 | 299 |
| 300 void addWithPosition(HInstruction instruction, ast.Node node) { | 300 void addWithPosition(HInstruction instruction, ast.Node node) { |
| 301 add(attachPosition(instruction, node)); | 301 add(attachPosition(instruction, node)); |
| 302 } | 302 } |
| 303 | 303 |
| 304 HTypeConversion buildFunctionTypeConversion( | |
| 305 HInstruction original, ResolutionDartType type, int kind) { | |
| 306 HInstruction reifiedType = buildFunctionType(type); | |
| 307 return new HTypeConversion.viaMethodOnType( | |
| 308 type, kind, original.instructionType, reifiedType, original); | |
| 309 } | |
| 310 | |
| 311 /** | 304 /** |
| 312 * Returns a complete argument list for a call of [function]. | 305 * Returns a complete argument list for a call of [function]. |
| 313 */ | 306 */ |
| 314 List<HInstruction> completeSendArgumentsList( | 307 List<HInstruction> completeSendArgumentsList( |
| 315 FunctionElement function, | 308 FunctionElement function, |
| 316 Selector selector, | 309 Selector selector, |
| 317 List<HInstruction> providedArguments, | 310 List<HInstruction> providedArguments, |
| 318 ast.Node currentNode) { | 311 ast.Node currentNode) { |
| 319 assert(invariant(function, function.isImplementation)); | 312 assert(invariant(function, function.isImplementation)); |
| 320 assert(providedArguments != null); | 313 assert(providedArguments != null); |
| (...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 "so they cannot be tested with an `is` expression."; | 2400 "so they cannot be tested with an `is` expression."; |
| 2408 } else { | 2401 } else { |
| 2409 assert(type is MalformedType); | 2402 assert(type is MalformedType); |
| 2410 ErroneousElement element = type.element; | 2403 ErroneousElement element = type.element; |
| 2411 message = element.message; | 2404 message = element.message; |
| 2412 } | 2405 } |
| 2413 generateTypeError(node, message); | 2406 generateTypeError(node, message); |
| 2414 HInstruction call = pop(); | 2407 HInstruction call = pop(); |
| 2415 return new HIs.compound(type, expression, call, commonMasks.boolType); | 2408 return new HIs.compound(type, expression, call, commonMasks.boolType); |
| 2416 } else if (type.isFunctionType) { | 2409 } else if (type.isFunctionType) { |
| 2417 List arguments = [buildFunctionType(type), expression]; | 2410 HInstruction representation = |
| 2418 pushInvokeDynamic( | 2411 typeBuilder.analyzeTypeArgument(type, sourceElement); |
| 2419 node, | 2412 List<HInstruction> inputs = <HInstruction>[ |
| 2420 new Selector.call(new PrivateName('_isTest', helpers.jsHelperLibrary), | 2413 expression, |
| 2421 CallStructure.ONE_ARG), | 2414 representation, |
| 2422 null, | 2415 ]; |
| 2423 arguments); | 2416 pushInvokeStatic(node, helpers.functionTypeTest, inputs, |
| 2424 return new HIs.compound(type, expression, pop(), commonMasks.boolType); | 2417 typeMask: commonMasks.boolType); |
| 2418 HInstruction call = pop(); |
| 2419 return new HIs.compound(type, expression, call, commonMasks.boolType); |
| 2425 } else if (type.isTypeVariable) { | 2420 } else if (type.isTypeVariable) { |
| 2426 HInstruction runtimeType = | 2421 HInstruction runtimeType = |
| 2427 typeBuilder.addTypeVariableReference(type, sourceElement); | 2422 typeBuilder.addTypeVariableReference(type, sourceElement); |
| 2428 MethodElement helper = helpers.checkSubtypeOfRuntimeType; | 2423 MethodElement helper = helpers.checkSubtypeOfRuntimeType; |
| 2429 List<HInstruction> inputs = <HInstruction>[expression, runtimeType]; | 2424 List<HInstruction> inputs = <HInstruction>[expression, runtimeType]; |
| 2430 pushInvokeStatic(null, helper, inputs, typeMask: commonMasks.boolType); | 2425 pushInvokeStatic(null, helper, inputs, typeMask: commonMasks.boolType); |
| 2431 HInstruction call = pop(); | 2426 HInstruction call = pop(); |
| 2432 return new HIs.variable(type, expression, call, commonMasks.boolType); | 2427 return new HIs.variable(type, expression, call, commonMasks.boolType); |
| 2433 } else if (RuntimeTypes.hasTypeArguments(type)) { | 2428 } else if (RuntimeTypes.hasTypeArguments(type)) { |
| 2434 ClassElement element = type.element; | 2429 ClassElement element = type.element; |
| (...skipping 4297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6732 this.oldReturnLocal, | 6727 this.oldReturnLocal, |
| 6733 this.oldReturnType, | 6728 this.oldReturnType, |
| 6734 this.oldResolvedAst, | 6729 this.oldResolvedAst, |
| 6735 this.oldStack, | 6730 this.oldStack, |
| 6736 this.oldLocalsHandler, | 6731 this.oldLocalsHandler, |
| 6737 this.inTryStatement, | 6732 this.inTryStatement, |
| 6738 this.allFunctionsCalledOnce, | 6733 this.allFunctionsCalledOnce, |
| 6739 this.oldElementInferenceResults) | 6734 this.oldElementInferenceResults) |
| 6740 : super(function); | 6735 : super(function); |
| 6741 } | 6736 } |
| OLD | NEW |