| 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 ClosedWorld closedWorld; | 8 final ClosedWorld closedWorld; |
| 9 final List<Selector> trivialNsmHandlers = <Selector>[]; | 9 final List<Selector> trivialNsmHandlers = <Selector>[]; |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 isTrivialNsmHandler(type, argNames, selector, jsName) && | 54 isTrivialNsmHandler(type, argNames, selector, jsName) && |
| 55 reflectionName == null) { | 55 reflectionName == null) { |
| 56 trivialNsmHandlers.add(selector); | 56 trivialNsmHandlers.add(selector); |
| 57 } else { | 57 } else { |
| 58 StubMethod method = | 58 StubMethod method = |
| 59 generator.generateStubForNoSuchMethod(jsName, selector); | 59 generator.generateStubForNoSuchMethod(jsName, selector); |
| 60 addProperty(method.name, method.code); | 60 addProperty(method.name, method.code); |
| 61 if (reflectionName != null) { | 61 if (reflectionName != null) { |
| 62 bool accessible = closedWorld.allFunctions | 62 bool accessible = closedWorld.allFunctions |
| 63 .filter(selector, null) | 63 .filter(selector, null) |
| 64 .any((Element e) => backend.isAccessibleByReflection(e)); | 64 .any((MemberElement e) => backend.isAccessibleByReflection(e)); |
| 65 addProperty( | 65 addProperty( |
| 66 namer.asName('+$reflectionName'), js(accessible ? '2' : '0')); | 66 namer.asName('+$reflectionName'), js(accessible ? '2' : '0')); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Identify the noSuchMethod handlers that are so simple that we can | 72 // Identify the noSuchMethod handlers that are so simple that we can |
| 73 // generate them programatically. | 73 // generate them programatically. |
| 74 bool isTrivialNsmHandler( | 74 bool isTrivialNsmHandler( |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 391 } |
| 392 | 392 |
| 393 String get value { | 393 String get value { |
| 394 if (_cachedValue == null) { | 394 if (_cachedValue == null) { |
| 395 _cachedValue = _computeDiffEncoding(); | 395 _cachedValue = _computeDiffEncoding(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 return _cachedValue; | 398 return _cachedValue; |
| 399 } | 399 } |
| 400 } | 400 } |
| OLD | NEW |