| 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.kernel.element_map; | 5 library dart2js.kernel.element_map; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
| 8 import 'package:kernel/clone.dart'; | 8 import 'package:kernel/clone.dart'; |
| 9 import 'package:kernel/type_algebra.dart'; | 9 import 'package:kernel/type_algebra.dart'; |
| 10 | 10 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 isStatic: isStatic, | 322 isStatic: isStatic, |
| 323 isExternal: isExternal, | 323 isExternal: isExternal, |
| 324 isAbstract: isAbstract); | 324 isAbstract: isAbstract); |
| 325 break; | 325 break; |
| 326 } | 326 } |
| 327 _memberList.add(new _FunctionData(node, node.function)); | 327 _memberList.add(new _FunctionData(node, node.function)); |
| 328 return function; | 328 return function; |
| 329 }); | 329 }); |
| 330 } | 330 } |
| 331 | 331 |
| 332 MemberEntity getSuperMember(ir.Member context, ir.Name name, ir.Member target, |
| 333 {bool setter: false}) { |
| 334 if (target != null) { |
| 335 return getMember(target); |
| 336 } |
| 337 KClass cls = getMember(context).enclosingClass; |
| 338 KClass superclass = _getSuperType(cls)?.element; |
| 339 while (superclass != null) { |
| 340 _KClassEnv env = _classEnvs[superclass.classIndex]; |
| 341 ir.Member superMember = env.lookupMember(name.name, setter: setter); |
| 342 if (superMember != null) { |
| 343 return getMember(superMember); |
| 344 } |
| 345 superclass = _getSuperType(superclass)?.element; |
| 346 } |
| 347 throw new SpannableAssertionFailure( |
| 348 cls, "No super method member found for ${name} in $cls."); |
| 349 } |
| 350 |
| 332 /// Returns the kernel [ir.Procedure] node for the [method]. | 351 /// Returns the kernel [ir.Procedure] node for the [method]. |
| 333 ir.Procedure _lookupProcedure(KFunction method) { | 352 ir.Procedure _lookupProcedure(KFunction method) { |
| 334 return _memberList[method.memberIndex].node; | 353 return _memberList[method.memberIndex].node; |
| 335 } | 354 } |
| 336 | 355 |
| 337 KField _getField(ir.Field node) { | 356 KField _getField(ir.Field node) { |
| 338 return _fieldMap.putIfAbsent(node, () { | 357 return _fieldMap.putIfAbsent(node, () { |
| 339 int memberIndex = _memberList.length; | 358 int memberIndex = _memberList.length; |
| 340 KLibrary library; | 359 KLibrary library; |
| 341 KClass enclosingClass; | 360 KClass enclosingClass; |
| (...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 return node.isExternal && | 1503 return node.isExternal && |
| 1485 !elementMap.isForeignLibrary(node.enclosingLibrary); | 1504 !elementMap.isForeignLibrary(node.enclosingLibrary); |
| 1486 } | 1505 } |
| 1487 | 1506 |
| 1488 @override | 1507 @override |
| 1489 bool isJsInteropMember(MemberEntity element) { | 1508 bool isJsInteropMember(MemberEntity element) { |
| 1490 // TODO(johnniwinther): Compute this. | 1509 // TODO(johnniwinther): Compute this. |
| 1491 return false; | 1510 return false; |
| 1492 } | 1511 } |
| 1493 } | 1512 } |
| OLD | NEW |