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 part of dart2js.ir_builder; | 5 part of dart2js.ir_builder; |
6 | 6 |
7 /** | 7 /** |
8 * This task iterates through all resolved elements and builds [ir.Node]s. The | 8 * This task iterates through all resolved elements and builds [ir.Node]s. The |
9 * nodes are stored in the [nodes] map and accessible through [hasIr] and | 9 * nodes are stored in the [nodes] map and accessible through [hasIr] and |
10 * [getIr]. | 10 * [getIr]. |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 // they are captured by a closure (i.e., they do outlive the activation of | 1028 // they are captured by a closure (i.e., they do outlive the activation of |
1029 // the function). | 1029 // the function). |
1030 markAsCaptured(local); | 1030 markAsCaptured(local); |
1031 } | 1031 } |
1032 node.visitChildren(this); | 1032 node.visitChildren(this); |
1033 } | 1033 } |
1034 | 1034 |
1035 visitFunctionExpression(ast.FunctionExpression node) { | 1035 visitFunctionExpression(ast.FunctionExpression node) { |
1036 FunctionElement oldFunction = currentFunction; | 1036 FunctionElement oldFunction = currentFunction; |
1037 currentFunction = elements[node]; | 1037 currentFunction = elements[node]; |
| 1038 if (currentFunction.asyncMarker != AsyncMarker.SYNC) { |
| 1039 giveup(node, "cannot handle async/sync*/async* functions"); |
| 1040 } |
1038 if (node.initializers != null) { | 1041 if (node.initializers != null) { |
1039 insideInitializer = true; | 1042 insideInitializer = true; |
1040 visit(node.initializers); | 1043 visit(node.initializers); |
1041 insideInitializer = false; | 1044 insideInitializer = false; |
1042 } | 1045 } |
1043 visit(node.body); | 1046 visit(node.body); |
1044 currentFunction = oldFunction; | 1047 currentFunction = oldFunction; |
1045 } | 1048 } |
1046 } | 1049 } |
1047 | 1050 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 ast.SendSet sendSet = fieldDefinition; | 1124 ast.SendSet sendSet = fieldDefinition; |
1122 initializer = visit(sendSet.arguments.first); | 1125 initializer = visit(sendSet.arguments.first); |
1123 } | 1126 } |
1124 return builder.makeFieldDefinition(initializer); | 1127 return builder.makeFieldDefinition(initializer); |
1125 }); | 1128 }); |
1126 } | 1129 } |
1127 | 1130 |
1128 ir.FunctionDefinition buildFunction(FunctionElement element) { | 1131 ir.FunctionDefinition buildFunction(FunctionElement element) { |
1129 assert(invariant(element, element.isImplementation)); | 1132 assert(invariant(element, element.isImplementation)); |
1130 ast.FunctionExpression node = element.node; | 1133 ast.FunctionExpression node = element.node; |
| 1134 if (element.asyncMarker != AsyncMarker.SYNC) { |
| 1135 giveup(null, 'cannot handle async-await'); |
| 1136 } |
1131 | 1137 |
1132 if (!element.isSynthesized) { | 1138 if (!element.isSynthesized) { |
1133 assert(node != null); | 1139 assert(node != null); |
1134 assert(elements[node] != null); | 1140 assert(elements[node] != null); |
1135 } else { | 1141 } else { |
1136 SynthesizedConstructorElementX constructor = element; | 1142 SynthesizedConstructorElementX constructor = element; |
1137 if (!constructor.isDefaultConstructor) { | 1143 if (!constructor.isDefaultConstructor) { |
1138 giveup(null, 'cannot handle synthetic forwarding constructors'); | 1144 giveup(null, 'cannot handle synthetic forwarding constructors'); |
1139 } | 1145 } |
1140 } | 1146 } |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 for (String argName in selector.getOrderedNamedArguments()) { | 1683 for (String argName in selector.getOrderedNamedArguments()) { |
1678 int nameIndex = selector.namedArguments.indexOf(argName); | 1684 int nameIndex = selector.namedArguments.indexOf(argName); |
1679 int translatedIndex = selector.positionalArgumentCount + nameIndex; | 1685 int translatedIndex = selector.positionalArgumentCount + nameIndex; |
1680 result.add(arguments[translatedIndex]); | 1686 result.add(arguments[translatedIndex]); |
1681 } | 1687 } |
1682 return result; | 1688 return result; |
1683 } | 1689 } |
1684 | 1690 |
1685 } | 1691 } |
1686 | 1692 |
OLD | NEW |