| 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.world_builder; | 5 library dart2js.kernel.world_builder; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/backend_api.dart'; | 10 import '../common/backend_api.dart'; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 KClass enclosingClass; | 224 KClass enclosingClass; |
| 225 if (node.enclosingClass != null) { | 225 if (node.enclosingClass != null) { |
| 226 enclosingClass = _getClass(node.enclosingClass); | 226 enclosingClass = _getClass(node.enclosingClass); |
| 227 library = enclosingClass.library; | 227 library = enclosingClass.library; |
| 228 } else { | 228 } else { |
| 229 library = _getLibrary(node.enclosingLibrary); | 229 library = _getLibrary(node.enclosingLibrary); |
| 230 } | 230 } |
| 231 Name name = getName(node.name); | 231 Name name = getName(node.name); |
| 232 bool isStatic = node.isStatic; | 232 bool isStatic = node.isStatic; |
| 233 bool isExternal = node.isExternal; | 233 bool isExternal = node.isExternal; |
| 234 bool isAbstract = node.isAbstract; |
| 234 KFunction function; | 235 KFunction function; |
| 235 switch (node.kind) { | 236 switch (node.kind) { |
| 236 case ir.ProcedureKind.Factory: | 237 case ir.ProcedureKind.Factory: |
| 237 throw new UnsupportedError("Cannot create method from factory."); | 238 throw new UnsupportedError("Cannot create method from factory."); |
| 238 case ir.ProcedureKind.Getter: | 239 case ir.ProcedureKind.Getter: |
| 239 function = new KGetter(memberIndex, library, enclosingClass, name, | 240 function = new KGetter(memberIndex, library, enclosingClass, name, |
| 240 isStatic: isStatic, isExternal: isExternal); | 241 isStatic: isStatic, |
| 242 isExternal: isExternal, |
| 243 isAbstract: isAbstract); |
| 241 break; | 244 break; |
| 242 case ir.ProcedureKind.Method: | 245 case ir.ProcedureKind.Method: |
| 243 case ir.ProcedureKind.Operator: | 246 case ir.ProcedureKind.Operator: |
| 244 function = new KMethod(memberIndex, library, enclosingClass, name, | 247 function = new KMethod(memberIndex, library, enclosingClass, name, |
| 245 isStatic: isStatic, isExternal: isExternal); | 248 isStatic: isStatic, |
| 249 isExternal: isExternal, |
| 250 isAbstract: isAbstract); |
| 246 break; | 251 break; |
| 247 case ir.ProcedureKind.Setter: | 252 case ir.ProcedureKind.Setter: |
| 248 function = new KSetter( | 253 function = new KSetter( |
| 249 memberIndex, library, enclosingClass, getName(node.name).setter, | 254 memberIndex, library, enclosingClass, getName(node.name).setter, |
| 250 isStatic: isStatic, isExternal: isExternal); | 255 isStatic: isStatic, |
| 256 isExternal: isExternal, |
| 257 isAbstract: isAbstract); |
| 251 break; | 258 break; |
| 252 } | 259 } |
| 253 _memberList.add(node); | 260 _memberList.add(node); |
| 254 return function; | 261 return function; |
| 255 }); | 262 }); |
| 256 } | 263 } |
| 257 | 264 |
| 258 KField _getField(ir.Field node) { | 265 KField _getField(ir.Field node) { |
| 259 return _fieldMap.putIfAbsent(node, () { | 266 return _fieldMap.putIfAbsent(node, () { |
| 260 int memberIndex = _memberList.length; | 267 int memberIndex = _memberList.length; |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 } | 914 } |
| 908 | 915 |
| 909 InterfaceType getMixinTypeForClass(KClass cls) { | 916 InterfaceType getMixinTypeForClass(KClass cls) { |
| 910 KClassEnv env = builder._classEnvs[cls.classIndex]; | 917 KClassEnv env = builder._classEnvs[cls.classIndex]; |
| 911 ir.Supertype mixedInType = env.cls.mixedInType; | 918 ir.Supertype mixedInType = env.cls.mixedInType; |
| 912 if (mixedInType == null) return null; | 919 if (mixedInType == null) return null; |
| 913 return builder.createInterfaceType( | 920 return builder.createInterfaceType( |
| 914 mixedInType.classNode, mixedInType.typeArguments); | 921 mixedInType.classNode, mixedInType.typeArguments); |
| 915 } | 922 } |
| 916 } | 923 } |
| OLD | NEW |