OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 class ClassStubGenerator { | 7 class ClassStubGenerator { |
8 final Namer namer; | 8 final Namer namer; |
9 final Compiler compiler; | 9 final Compiler compiler; |
10 final JavaScriptBackend backend; | 10 final JavaScriptBackend backend; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 List<String> parameterNames = | 160 List<String> parameterNames = |
161 new List.generate(selector.argumentCount, (i) => '\$$i'); | 161 new List.generate(selector.argumentCount, (i) => '\$$i'); |
162 | 162 |
163 List<jsAst.Expression> argNames = | 163 List<jsAst.Expression> argNames = |
164 selector.callStructure.getOrderedNamedArguments().map((String name) => | 164 selector.callStructure.getOrderedNamedArguments().map((String name) => |
165 js.string(name)).toList(); | 165 js.string(name)).toList(); |
166 | 166 |
167 jsAst.Name methodName = namer.asName(selector.invocationMirrorMemberName); | 167 jsAst.Name methodName = namer.asName(selector.invocationMirrorMemberName); |
168 jsAst.Name internalName = namer.invocationMirrorInternalName(selector); | 168 jsAst.Name internalName = namer.invocationMirrorInternalName(selector); |
169 | 169 |
170 assert(backend.isInterceptedName(Compiler.NO_SUCH_METHOD)); | 170 assert(backend.isInterceptedName(Identifiers.noSuchMethod_)); |
171 bool isIntercepted = backend.isInterceptedName(selector.name); | 171 bool isIntercepted = backend.isInterceptedName(selector.name); |
172 jsAst.Expression expression = | 172 jsAst.Expression expression = |
173 js('''this.#noSuchMethodName(#receiver, | 173 js('''this.#noSuchMethodName(#receiver, |
174 #createInvocationMirror(#methodName, | 174 #createInvocationMirror(#methodName, |
175 #internalName, | 175 #internalName, |
176 #type, | 176 #type, |
177 #arguments, | 177 #arguments, |
178 #namedArguments))''', | 178 #namedArguments))''', |
179 {'receiver': isIntercepted ? r'$receiver' : 'this', | 179 {'receiver': isIntercepted ? r'$receiver' : 'this', |
180 'noSuchMethodName': namer.noSuchMethodName, | 180 'noSuchMethodName': namer.noSuchMethodName, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 ? function() { | 288 ? function() { |
289 if (cache === void 0) cache = #tearOff( | 289 if (cache === void 0) cache = #tearOff( |
290 this, funcs, reflectionInfo, true, [], name).prototype; | 290 this, funcs, reflectionInfo, true, [], name).prototype; |
291 return cache; | 291 return cache; |
292 } | 292 } |
293 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); | 293 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); |
294 }''', {'tearOff': tearOffAccessExpression}); | 294 }''', {'tearOff': tearOffAccessExpression}); |
295 | 295 |
296 return <jsAst.Statement>[tearOffGetter, tearOff]; | 296 return <jsAst.Statement>[tearOffGetter, tearOff]; |
297 } | 297 } |
OLD | NEW |