| 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 library dart2js.js_emitter.program_builder; | 5 library dart2js.js_emitter.program_builder; |
| 6 | 6 |
| 7 import '../../closure.dart' show ClosureFieldElement; | 7 import '../../closure.dart' show ClosureFieldElement; |
| 8 import '../../common.dart'; | 8 import '../../common.dart'; |
| 9 import '../../common/names.dart' show Names, Selectors; | 9 import '../../common/names.dart' show Names, Selectors; |
| 10 import '../../compiler.dart' show Compiler; | 10 import '../../compiler.dart' show Compiler; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // a regular getter that returns a JavaScript function and tearing off | 347 // a regular getter that returns a JavaScript function and tearing off |
| 348 // a method in the case where there exist multiple JavaScript classes | 348 // a method in the case where there exist multiple JavaScript classes |
| 349 // that conflict on whether the member is a getter or a method. | 349 // that conflict on whether the member is a getter or a method. |
| 350 var interceptorClass = _classes[helpers.jsJavaScriptObjectClass]; | 350 var interceptorClass = _classes[helpers.jsJavaScriptObjectClass]; |
| 351 var stubNames = new Set<String>(); | 351 var stubNames = new Set<String>(); |
| 352 librariesMap.forEach((LibraryElement library, List<Element> elements) { | 352 librariesMap.forEach((LibraryElement library, List<Element> elements) { |
| 353 for (Element e in elements) { | 353 for (Element e in elements) { |
| 354 if (e is ClassElement && backend.nativeData.isJsInteropClass(e)) { | 354 if (e is ClassElement && backend.nativeData.isJsInteropClass(e)) { |
| 355 e.declaration.forEachMember((_, Element member) { | 355 e.declaration.forEachMember((_, Element member) { |
| 356 var jsName = | 356 var jsName = |
| 357 backend.nativeData.getUnescapedJSInteropName(member.name); | 357 backend.nativeData.computeUnescapedJSInteropName(member.name); |
| 358 if (!member.isInstanceMember) return; | 358 if (!member.isInstanceMember) return; |
| 359 if (member.isGetter || member.isField || member.isFunction) { | 359 if (member.isGetter || member.isField || member.isFunction) { |
| 360 var selectors = worldBuilder.getterInvocationsByName(member.name); | 360 var selectors = worldBuilder.getterInvocationsByName(member.name); |
| 361 if (selectors != null && !selectors.isEmpty) { | 361 if (selectors != null && !selectors.isEmpty) { |
| 362 for (var selector in selectors.keys) { | 362 for (var selector in selectors.keys) { |
| 363 var stubName = namer.invocationName(selector); | 363 var stubName = namer.invocationName(selector); |
| 364 if (stubNames.add(stubName.key)) { | 364 if (stubNames.add(stubName.key)) { |
| 365 interceptorClass.callStubs.add(_buildStubMethod(stubName, | 365 interceptorClass.callStubs.add(_buildStubMethod(stubName, |
| 366 js.js('function(obj) { return obj.# }', [jsName]), | 366 js.js('function(obj) { return obj.# }', [jsName]), |
| 367 element: member)); | 367 element: member)); |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 Constant constant = new Constant(name, holder, constantValue); | 975 Constant constant = new Constant(name, holder, constantValue); |
| 976 _constants[constantValue] = constant; | 976 _constants[constantValue] = constant; |
| 977 } | 977 } |
| 978 } | 978 } |
| 979 | 979 |
| 980 Holder _registerStaticStateHolder() { | 980 Holder _registerStaticStateHolder() { |
| 981 return _registry.registerHolder(namer.staticStateHolder, | 981 return _registry.registerHolder(namer.staticStateHolder, |
| 982 isStaticStateHolder: true); | 982 isStaticStateHolder: true); |
| 983 } | 983 } |
| 984 } | 984 } |
| OLD | NEW |