Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart b/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart |
| index 7057a5504a20b48230475302e44b897bf3a0e5eb..5dda57843d7958316e2e1de85a56e703c2d9086c 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart |
| @@ -419,12 +419,39 @@ class IrBuilder extends ResolvedVisitor<ir.Definition> { |
| if (!Elements.isLocal(element)) return giveup(); |
| if (node.assignmentOperator.source != '=') return giveup(); |
| // Exactly one argument expected for a simple assignment. |
| - assert(!node.arguments.isEmpty && node.arguments.tail.isEmpty); |
| + assert(!node.arguments.isEmpty); |
| + assert(node.arguments.tail.isEmpty); |
| ir.Definition result = node.arguments.head.accept(this); |
| assignedVars[variableIndex[element]] = result; |
| return result; |
| } |
| + ir.Definition visitVariableDefinitions(ast.VariableDefinitions node) { |
| + assert(isOpen); |
| + for (ast.Node definition in node.definitions.nodes) { |
| + Element element = elements[definition]; |
| + // Definitions are either SendSets if there is an initializer, or |
| + // Identifiers if there is no initializer. |
| + if (definition is ast.SendSet) { |
| + assert(!definition.arguments.isEmpty); |
| + assert(definition.arguments.tail.isEmpty); |
| + ir.Definition initialValue = definition.arguments.head.accept(this); |
| + if (!isOpen) return null; |
|
karlklose
2014/04/11 09:01:56
Perhaps add a comment.
Kevin Millikin (Google)
2014/04/11 10:28:51
I will.
|
| + variableIndex[element] = assignedVars.length; |
| + assignedVars.add(initialValue); |
| + } else { |
| + assert(definition is ast.Identifier); |
| + // The initial value is null. |
| + // TODO(kmillikin): Consider pooling constants. |
| + ir.Constant constant = new ir.Constant(constantSystem.createNull()); |
| + add(new ir.LetPrim(constant)); |
| + variableIndex[element] = assignedVars.length; |
| + assignedVars.add(constant); |
| + } |
| + } |
| + return null; |
| + } |
| + |
| static final String ABORT_IRNODE_BUILDER = "IrNode builder aborted"; |
| ir.Definition giveup() => throw ABORT_IRNODE_BUILDER; |