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 class Interceptors { | 5 class Interceptors { |
6 Compiler compiler; | 6 Compiler compiler; |
7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
8 | 8 |
9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void startFunction(FunctionElement function, | 301 void startFunction(FunctionElement function, |
302 FunctionExpression node) { | 302 FunctionExpression node) { |
303 | 303 |
304 ClosureTranslator translator = new ClosureTranslator(builder); | 304 ClosureTranslator translator = new ClosureTranslator(builder); |
305 closureData = translator.translate(node); | 305 closureData = translator.translate(node); |
306 | 306 |
307 FunctionSignature params = function.computeSignature(builder.compiler); | 307 FunctionSignature params = function.computeSignature(builder.compiler); |
308 params.forEachParameter((Element element) { | 308 params.forEachParameter((Element element) { |
309 HInstruction parameter = new HParameterValue(element); | 309 HInstruction parameter = new HParameterValue(element); |
310 builder.add(parameter); | 310 builder.add(parameter); |
311 parameter = builder.potentiallyCheckType(parameter, element); | 311 builder.potentiallyCheckType(parameter, element); |
312 directLocals[element] = parameter; | 312 directLocals[element] = parameter; |
313 }); | 313 }); |
314 | 314 |
315 enterScope(node); | 315 enterScope(node); |
316 | 316 |
317 // If the freeVariableMapping is not empty, then this function was a | 317 // If the freeVariableMapping is not empty, then this function was a |
318 // nested closure that captures variables. Redirect the captured | 318 // nested closure that captures variables. Redirect the captured |
319 // variables to fields in the closure. | 319 // variables to fields in the closure. |
320 closureData.freeVariableMapping.forEach((Element from, Element to) { | 320 closureData.freeVariableMapping.forEach((Element from, Element to) { |
321 redirectElement(from, to); | 321 redirectElement(from, to); |
(...skipping 3108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3430 void visitNodeList(NodeList node) { | 3430 void visitNodeList(NodeList node) { |
3431 node.visitChildren(this); | 3431 node.visitChildren(this); |
3432 } | 3432 } |
3433 | 3433 |
3434 HInstruction concat(HInstruction left, HInstruction right) { | 3434 HInstruction concat(HInstruction left, HInstruction right) { |
3435 HInstruction instruction = new HStringConcat(left, right, node); | 3435 HInstruction instruction = new HStringConcat(left, right, node); |
3436 builder.add(instruction); | 3436 builder.add(instruction); |
3437 return instruction; | 3437 return instruction; |
3438 } | 3438 } |
3439 } | 3439 } |
OLD | NEW |