| 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 /** | 5 /** |
| 6 * A function element that represents a closure call. The signature is copied | 6 * A function element that represents a closure call. The signature is copied |
| 7 * from the given element. | 7 * from the given element. |
| 8 */ | 8 */ |
| 9 class ClosureInvocationElement extends FunctionElement { | 9 class ClosureInvocationElement extends FunctionElement { |
| 10 ClosureInvocationElement(SourceString name, | 10 ClosureInvocationElement(SourceString name, |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 | 760 |
| 761 bool hasOptionalParameters = member.optionalParameterCount(compiler) != 0; | 761 bool hasOptionalParameters = member.optionalParameterCount(compiler) != 0; |
| 762 int parameterCount = member.parameterCount(compiler); | 762 int parameterCount = member.parameterCount(compiler); |
| 763 | 763 |
| 764 String closureClass = | 764 String closureClass = |
| 765 hasOptionalParameters ? null : boundClosureCache[parameterCount]; | 765 hasOptionalParameters ? null : boundClosureCache[parameterCount]; |
| 766 if (closureClass === null) { | 766 if (closureClass === null) { |
| 767 // Either the class was not cached yet, or there are optional parameters. | 767 // Either the class was not cached yet, or there are optional parameters. |
| 768 // Create a new closure class. | 768 // Create a new closure class. |
| 769 SourceString name = const SourceString("BoundClosure"); | 769 SourceString name = const SourceString("BoundClosure"); |
| 770 ClassElement closureClassElement = | 770 ClassElement closureClassElement = new ClosureClassElement( |
| 771 new ClosureClassElement(name, compiler, member.getCompilationUnit()); | 771 name, compiler, member, member.getCompilationUnit()); |
| 772 String mangledName = namer.getName(closureClassElement); | 772 String mangledName = namer.getName(closureClassElement); |
| 773 String superName = namer.getName(closureClassElement.superclass); | 773 String superName = namer.getName(closureClassElement.superclass); |
| 774 needsClosureClass = true; | 774 needsClosureClass = true; |
| 775 | 775 |
| 776 // Define the constructor with a name so that Object.toString can | 776 // Define the constructor with a name so that Object.toString can |
| 777 // find the class name of the closure class. | 777 // find the class name of the closure class. |
| 778 boundClosureBuffer.add(""" | 778 boundClosureBuffer.add(""" |
| 779 $classesCollector.$mangledName = {'': | 779 $classesCollector.$mangledName = {'': |
| 780 ['self', 'target'], | 780 ['self', 'target'], |
| 781 'super': '$superName', | 781 'super': '$superName', |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 sourceName = token.slowToString(); | 1199 sourceName = token.slowToString(); |
| 1200 } | 1200 } |
| 1201 int totalOffset = bufferOffset + offset; | 1201 int totalOffset = bufferOffset + offset; |
| 1202 sourceMapBuilder.addMapping( | 1202 sourceMapBuilder.addMapping( |
| 1203 sourceFile, token.charOffset, sourceName, totalOffset); | 1203 sourceFile, token.charOffset, sourceName, totalOffset); |
| 1204 }); | 1204 }); |
| 1205 } | 1205 } |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 typedef void DefineMemberFunction(String invocationName, CodeBuffer definition); | 1208 typedef void DefineMemberFunction(String invocationName, CodeBuffer definition); |
| OLD | NEW |