| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.ir_builder; | 5 library dart2js.ir_builder; |
| 6 | 6 |
| 7 import '../closure.dart' as closure; | 7 import '../closure.dart' as closure; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
| 10 Names, | 10 Names, |
| (...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2405 value = buildThis(); | 2405 value = buildThis(); |
| 2406 } else if (field.local is closure.TypeVariableLocal) { | 2406 } else if (field.local is closure.TypeVariableLocal) { |
| 2407 closure.TypeVariableLocal variable = field.local; | 2407 closure.TypeVariableLocal variable = field.local; |
| 2408 value = buildTypeVariableAccess(variable.typeVariable); | 2408 value = buildTypeVariableAccess(variable.typeVariable); |
| 2409 } else { | 2409 } else { |
| 2410 value = environment.lookup(field.local); | 2410 value = environment.lookup(field.local); |
| 2411 } | 2411 } |
| 2412 arguments.add(value); | 2412 arguments.add(value); |
| 2413 } | 2413 } |
| 2414 return addPrimitive(new ir.CreateInstance( | 2414 return addPrimitive(new ir.CreateInstance( |
| 2415 classElement, arguments, const <ir.Primitive>[], sourceInformation)); | 2415 classElement, arguments, null, sourceInformation)); |
| 2416 } | 2416 } |
| 2417 | 2417 |
| 2418 /// Create a read access of [local] function, variable, or parameter. | 2418 /// Create a read access of [local] function, variable, or parameter. |
| 2419 ir.Primitive buildLocalGet(LocalElement local) { | 2419 ir.Primitive buildLocalGet(LocalElement local) { |
| 2420 assert(isOpen); | 2420 assert(isOpen); |
| 2421 ClosureLocation location = state.boxedVariables[local]; | 2421 ClosureLocation location = state.boxedVariables[local]; |
| 2422 if (location != null) { | 2422 if (location != null) { |
| 2423 ir.Primitive result = new ir.GetField(environment.lookup(location.box), | 2423 ir.Primitive result = new ir.GetField(environment.lookup(location.box), |
| 2424 location.field); | 2424 location.field); |
| 2425 result.useElementAsHint(local); | 2425 result.useElementAsHint(local); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2571 ir.Primitive buildTypeExpression(DartType type) { | 2571 ir.Primitive buildTypeExpression(DartType type) { |
| 2572 type = program.unaliasType(type); | 2572 type = program.unaliasType(type); |
| 2573 if (type is TypeVariableType) { | 2573 if (type is TypeVariableType) { |
| 2574 return buildTypeVariableAccess(type); | 2574 return buildTypeVariableAccess(type); |
| 2575 } else if (type is InterfaceType || type is FunctionType) { | 2575 } else if (type is InterfaceType || type is FunctionType) { |
| 2576 List<ir.Primitive> arguments = <ir.Primitive>[]; | 2576 List<ir.Primitive> arguments = <ir.Primitive>[]; |
| 2577 type.forEachTypeVariable((TypeVariableType variable) { | 2577 type.forEachTypeVariable((TypeVariableType variable) { |
| 2578 ir.Primitive value = buildTypeVariableAccess(variable); | 2578 ir.Primitive value = buildTypeVariableAccess(variable); |
| 2579 arguments.add(value); | 2579 arguments.add(value); |
| 2580 }); | 2580 }); |
| 2581 return addPrimitive(new ir.TypeExpression(type, arguments)); | 2581 return addPrimitive(new ir.TypeExpression(ir.TypeExpressionKind.COMPLETE, |
| 2582 type, arguments)); |
| 2582 } else if (type.treatAsDynamic) { | 2583 } else if (type.treatAsDynamic) { |
| 2583 return buildNullConstant(); | 2584 return buildNullConstant(); |
| 2584 } else { | 2585 } else { |
| 2585 // TypedefType can reach here, and possibly other things. | 2586 // TypedefType can reach here, and possibly other things. |
| 2586 throw 'unimplemented translation of type expression $type (${type.kind})'; | 2587 throw 'unimplemented translation of type expression $type (${type.kind})'; |
| 2587 } | 2588 } |
| 2588 } | 2589 } |
| 2589 | 2590 |
| 2590 /// Obtains the internal type representation of the type held in [variable]. | 2591 /// Obtains the internal type representation of the type held in [variable]. |
| 2591 /// | 2592 /// |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 } | 2839 } |
| 2839 | 2840 |
| 2840 class SwitchCaseInfo { | 2841 class SwitchCaseInfo { |
| 2841 final List<ir.Primitive> constants = <ir.Primitive>[]; | 2842 final List<ir.Primitive> constants = <ir.Primitive>[]; |
| 2842 final SubbuildFunction buildBody; | 2843 final SubbuildFunction buildBody; |
| 2843 | 2844 |
| 2844 SwitchCaseInfo(this.buildBody); | 2845 SwitchCaseInfo(this.buildBody); |
| 2845 | 2846 |
| 2846 void addConstant(ir.Primitive constant) => constants.add(constant); | 2847 void addConstant(ir.Primitive constant) => constants.add(constant); |
| 2847 } | 2848 } |
| OLD | NEW |