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.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 class NsmEmitter extends CodeEmitterHelper { | 7 class NsmEmitter extends CodeEmitterHelper { |
8 final List<Selector> trivialNsmHandlers = <Selector>[]; | 8 final List<Selector> trivialNsmHandlers = <Selector>[]; |
9 | 9 |
10 /// If this is true then we can generate the noSuchMethod handlers at startup | 10 /// If this is true then we can generate the noSuchMethod handlers at startup |
(...skipping 24 matching lines...) Expand all Loading... |
35 (addedJsNames.length < VERY_FEW_NO_SUCH_METHOD_HANDLERS); | 35 (addedJsNames.length < VERY_FEW_NO_SUCH_METHOD_HANDLERS); |
36 for (String jsName in addedJsNames.keys.toList()..sort()) { | 36 for (String jsName in addedJsNames.keys.toList()..sort()) { |
37 Selector selector = addedJsNames[jsName]; | 37 Selector selector = addedJsNames[jsName]; |
38 String reflectionName = emitter.getReflectionName(selector, jsName); | 38 String reflectionName = emitter.getReflectionName(selector, jsName); |
39 | 39 |
40 if (reflectionName != null) { | 40 if (reflectionName != null) { |
41 emitter.mangledFieldNames[jsName] = reflectionName; | 41 emitter.mangledFieldNames[jsName] = reflectionName; |
42 } | 42 } |
43 | 43 |
44 List<jsAst.Expression> argNames = | 44 List<jsAst.Expression> argNames = |
45 selector.getOrderedNamedArguments().map((String name) => | 45 selector.callStructure.getOrderedNamedArguments().map((String name) => |
46 js.string(name)).toList(); | 46 js.string(name)).toList(); |
47 int type = selector.invocationMirrorKind; | 47 int type = selector.invocationMirrorKind; |
48 if (!haveVeryFewNoSuchMemberHandlers && | 48 if (!haveVeryFewNoSuchMemberHandlers && |
49 isTrivialNsmHandler(type, argNames, selector, jsName) && | 49 isTrivialNsmHandler(type, argNames, selector, jsName) && |
50 reflectionName == null) { | 50 reflectionName == null) { |
51 trivialNsmHandlers.add(selector); | 51 trivialNsmHandlers.add(selector); |
52 } else { | 52 } else { |
53 StubMethod method = | 53 StubMethod method = |
54 generator.generateStubForNoSuchMethod(jsName, selector); | 54 generator.generateStubForNoSuchMethod(jsName, selector); |
55 addProperty(method.name, method.code); | 55 addProperty(method.name, method.code); |
56 if (reflectionName != null) { | 56 if (reflectionName != null) { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 }''', { | 318 }''', { |
319 'sliceOffsetParams': sliceOffsetParams, | 319 'sliceOffsetParams': sliceOffsetParams, |
320 'noSuchMethodName': namer.noSuchMethodName, | 320 'noSuchMethodName': namer.noSuchMethodName, |
321 'createInvocationMirror': createInvocationMirror, | 321 'createInvocationMirror': createInvocationMirror, |
322 'names': minify ? 'shortNames' : 'longNames', | 322 'names': minify ? 'shortNames' : 'longNames', |
323 'sliceOffsetArguments': sliceOffsetArguments})); | 323 'sliceOffsetArguments': sliceOffsetArguments})); |
324 | 324 |
325 return statements; | 325 return statements; |
326 } | 326 } |
327 } | 327 } |
OLD | NEW |