| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 isStatic: isStatic, isExternal: isExternal, isAbstract: isAbstract); | 165 isStatic: isStatic, isExternal: isExternal, isAbstract: isAbstract); |
| 166 } | 166 } |
| 167 | 167 |
| 168 IndexedField createField(int memberIndex, LibraryEntity library, | 168 IndexedField createField(int memberIndex, LibraryEntity library, |
| 169 ClassEntity enclosingClass, Name name, | 169 ClassEntity enclosingClass, Name name, |
| 170 {bool isStatic, bool isAssignable, bool isConst}) { | 170 {bool isStatic, bool isAssignable, bool isConst}) { |
| 171 return new JField(memberIndex, library, enclosingClass, name, | 171 return new JField(memberIndex, library, enclosingClass, name, |
| 172 isStatic: isStatic, isAssignable: isAssignable, isConst: isConst); | 172 isStatic: isStatic, isAssignable: isAssignable, isConst: isConst); |
| 173 } | 173 } |
| 174 | 174 |
| 175 Local createLocalFunction(String name, MemberEntity memberContext, | |
| 176 Entity executableContext, FunctionType functionType) { | |
| 177 // TODO(efortuna, johnniwinther): This function should not be called once | |
| 178 // the K + J element situation has been properly sorted out. Ultimately this | |
| 179 // should throw. | |
| 180 return new JLocalFunction( | |
| 181 name, memberContext, executableContext, functionType); | |
| 182 } | |
| 183 | |
| 184 LibraryEntity convertLibrary(IndexedLibrary library) { | 175 LibraryEntity convertLibrary(IndexedLibrary library) { |
| 185 return createLibrary( | 176 return createLibrary( |
| 186 library.libraryIndex, library.name, library.canonicalUri); | 177 library.libraryIndex, library.name, library.canonicalUri); |
| 187 } | 178 } |
| 188 | 179 |
| 189 ClassEntity convertClass(LibraryEntity library, IndexedClass cls) { | 180 ClassEntity convertClass(LibraryEntity library, IndexedClass cls) { |
| 190 return createClass(library, cls.classIndex, cls.name, | 181 return createClass(library, cls.classIndex, cls.name, |
| 191 isAbstract: cls.isAbstract); | 182 isAbstract: cls.isAbstract); |
| 192 } | 183 } |
| 193 | 184 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 final Entity typeDeclaration; | 531 final Entity typeDeclaration; |
| 541 final String name; | 532 final String name; |
| 542 final int index; | 533 final int index; |
| 543 | 534 |
| 544 JTypeVariable( | 535 JTypeVariable( |
| 545 this.typeVariableIndex, this.typeDeclaration, this.name, this.index); | 536 this.typeVariableIndex, this.typeDeclaration, this.name, this.index); |
| 546 | 537 |
| 547 String toString() => | 538 String toString() => |
| 548 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; | 539 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; |
| 549 } | 540 } |
| 550 | |
| 551 class JLocalFunction implements Local { | |
| 552 final String name; | |
| 553 final MemberEntity memberContext; | |
| 554 final Entity executableContext; | |
| 555 final FunctionType functionType; | |
| 556 | |
| 557 JLocalFunction( | |
| 558 this.name, this.memberContext, this.executableContext, this.functionType); | |
| 559 | |
| 560 String toString() => '${jsElementPrefix}local_function' | |
| 561 '(${memberContext.name}.${name ?? '<anonymous>'})'; | |
| 562 } | |
| OLD | NEW |