| 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.full_emitter; | 5 part of dart2js.js_emitter.full_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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 int type = selector.invocationMirrorKind; | 48 int type = selector.invocationMirrorKind; |
| 49 if (!haveVeryFewNoSuchMemberHandlers && | 49 if (!haveVeryFewNoSuchMemberHandlers && |
| 50 isTrivialNsmHandler(type, argNames, selector, jsName) && | 50 isTrivialNsmHandler(type, argNames, selector, jsName) && |
| 51 reflectionName == null) { | 51 reflectionName == null) { |
| 52 trivialNsmHandlers.add(selector); | 52 trivialNsmHandlers.add(selector); |
| 53 } else { | 53 } else { |
| 54 StubMethod method = | 54 StubMethod method = |
| 55 generator.generateStubForNoSuchMethod(jsName, selector); | 55 generator.generateStubForNoSuchMethod(jsName, selector); |
| 56 addProperty(method.name, method.code); | 56 addProperty(method.name, method.code); |
| 57 if (reflectionName != null) { | 57 if (reflectionName != null) { |
| 58 bool accessible = compiler.world.allFunctions | 58 bool accessible = compiler.closedWorld.allFunctions |
| 59 .filter(selector, null) | 59 .filter(selector, null) |
| 60 .any((Element e) => backend.isAccessibleByReflection(e)); | 60 .any((Element e) => backend.isAccessibleByReflection(e)); |
| 61 addProperty( | 61 addProperty( |
| 62 namer.asName('+$reflectionName'), js(accessible ? '2' : '0')); | 62 namer.asName('+$reflectionName'), js(accessible ? '2' : '0')); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Identify the noSuchMethod handlers that are so simple that we can | 68 // Identify the noSuchMethod handlers that are so simple that we can |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 387 } |
| 388 | 388 |
| 389 String get value { | 389 String get value { |
| 390 if (_cachedValue == null) { | 390 if (_cachedValue == null) { |
| 391 _cachedValue = _computeDiffEncoding(); | 391 _cachedValue = _computeDiffEncoding(); |
| 392 } | 392 } |
| 393 | 393 |
| 394 return _cachedValue; | 394 return _cachedValue; |
| 395 } | 395 } |
| 396 } | 396 } |
| OLD | NEW |