OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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_model.elements; | 5 library dart2js.js_model.elements; |
6 | 6 |
7 import '../elements/entities.dart'; | 7 import '../elements/entities.dart'; |
8 import '../elements/names.dart'; | 8 import '../elements/names.dart'; |
9 import '../elements/types.dart'; | 9 import '../elements/types.dart'; |
10 import '../kernel/elements.dart'; | 10 import '../kernel/elements.dart'; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 JClass(this.library, this.classIndex, this.name, {this.isAbstract}); | 316 JClass(this.library, this.classIndex, this.name, {this.isAbstract}); |
317 | 317 |
318 @override | 318 @override |
319 bool get isClosure => false; | 319 bool get isClosure => false; |
320 | 320 |
321 String toString() => '${jsElementPrefix}class($name)'; | 321 String toString() => '${jsElementPrefix}class($name)'; |
322 } | 322 } |
323 | 323 |
324 abstract class JMember implements MemberEntity, IndexedMember { | 324 abstract class JMember implements MemberEntity, IndexedMember { |
325 /// Member index used for fast lookup in [JsToFrontendMapImpl]. | 325 /// Member index used for fast lookup in [JsToFrontendMapImpl]. |
326 final int memberIndex; | 326 int _memberIndex; |
327 final JLibrary library; | 327 final JLibrary library; |
328 final JClass enclosingClass; | 328 final JClass enclosingClass; |
329 final Name _name; | 329 final Name _name; |
330 final bool _isStatic; | 330 final bool _isStatic; |
331 | 331 |
332 JMember(this.memberIndex, this.library, this.enclosingClass, this._name, | 332 JMember(this._memberIndex, this.library, this.enclosingClass, this._name, |
333 {bool isStatic: false}) | 333 {bool isStatic: false}) |
334 : _isStatic = isStatic; | 334 : _isStatic = isStatic; |
335 | 335 |
| 336 int get memberIndex => _memberIndex; |
| 337 |
| 338 /// Should only be called by closure methods. All others should set |
| 339 /// memberIndex at initialization time. |
| 340 void set setClosureMemberIndex(int newIndex) { |
| 341 _memberIndex = newIndex; |
| 342 } |
| 343 |
336 String get name => _name.text; | 344 String get name => _name.text; |
337 | 345 |
338 Name get memberName => _name; | 346 Name get memberName => _name; |
339 | 347 |
340 @override | 348 @override |
341 bool get isAssignable => false; | 349 bool get isAssignable => false; |
342 | 350 |
343 @override | 351 @override |
344 bool get isConst => false; | 352 bool get isConst => false; |
345 | 353 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 final MemberEntity memberContext; | 553 final MemberEntity memberContext; |
546 final Entity executableContext; | 554 final Entity executableContext; |
547 final FunctionType functionType; | 555 final FunctionType functionType; |
548 | 556 |
549 JLocalFunction( | 557 JLocalFunction( |
550 this.name, this.memberContext, this.executableContext, this.functionType); | 558 this.name, this.memberContext, this.executableContext, this.functionType); |
551 | 559 |
552 String toString() => '${jsElementPrefix}local_function' | 560 String toString() => '${jsElementPrefix}local_function' |
553 '(${memberContext.name}.${name ?? '<anonymous>'})'; | 561 '(${memberContext.name}.${name ?? '<anonymous>'})'; |
554 } | 562 } |
OLD | NEW |