| 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 '../common/names.dart' show Names; | 7 import '../common/names.dart' show Names; |
| 8 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
| 9 import '../elements/names.dart'; | 9 import '../elements/names.dart'; |
| 10 import '../elements/types.dart'; | 10 import '../elements/types.dart'; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 IndexedLibrary createLibrary( | 94 IndexedLibrary createLibrary( |
| 95 int libraryIndex, String name, Uri canonicalUri) { | 95 int libraryIndex, String name, Uri canonicalUri) { |
| 96 return new JLibrary(libraryIndex, name, canonicalUri); | 96 return new JLibrary(libraryIndex, name, canonicalUri); |
| 97 } | 97 } |
| 98 | 98 |
| 99 IndexedClass createClass(LibraryEntity library, int classIndex, String name, | 99 IndexedClass createClass(LibraryEntity library, int classIndex, String name, |
| 100 {bool isAbstract}) { | 100 {bool isAbstract}) { |
| 101 return new JClass(library, classIndex, name, isAbstract: isAbstract); | 101 return new JClass(library, classIndex, name, isAbstract: isAbstract); |
| 102 } | 102 } |
| 103 | 103 |
| 104 IndexedTypedef createTypedef( |
| 105 LibraryEntity library, int typedefIndex, String name) { |
| 106 return new JTypedef(library, typedefIndex, name); |
| 107 } |
| 108 |
| 104 TypeVariableEntity createTypeVariable( | 109 TypeVariableEntity createTypeVariable( |
| 105 int typeVariableIndex, Entity typeDeclaration, String name, int index) { | 110 int typeVariableIndex, Entity typeDeclaration, String name, int index) { |
| 106 return new JTypeVariable(typeVariableIndex, typeDeclaration, name, index); | 111 return new JTypeVariable(typeVariableIndex, typeDeclaration, name, index); |
| 107 } | 112 } |
| 108 | 113 |
| 109 IndexedConstructor createGenerativeConstructor( | 114 IndexedConstructor createGenerativeConstructor( |
| 110 int memberIndex, | 115 int memberIndex, |
| 111 ClassEntity enclosingClass, | 116 ClassEntity enclosingClass, |
| 112 Name name, | 117 Name name, |
| 113 ParameterStructure parameterStructure, | 118 ParameterStructure parameterStructure, |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 return const DynamicType(); | 261 return const DynamicType(); |
| 257 } | 262 } |
| 258 | 263 |
| 259 @override | 264 @override |
| 260 DartType visitInterfaceType(InterfaceType type, EntityConverter converter) { | 265 DartType visitInterfaceType(InterfaceType type, EntityConverter converter) { |
| 261 return new InterfaceType( | 266 return new InterfaceType( |
| 262 converter(type.element), visitList(type.typeArguments, converter)); | 267 converter(type.element), visitList(type.typeArguments, converter)); |
| 263 } | 268 } |
| 264 | 269 |
| 265 @override | 270 @override |
| 271 DartType visitTypedefType(TypedefType type, EntityConverter converter) { |
| 272 return new TypedefType( |
| 273 converter(type.element), visitList(type.typeArguments, converter)); |
| 274 } |
| 275 |
| 276 @override |
| 266 DartType visitFunctionType(FunctionType type, EntityConverter converter) { | 277 DartType visitFunctionType(FunctionType type, EntityConverter converter) { |
| 267 return new FunctionType( | 278 return new FunctionType( |
| 268 visit(type.returnType, converter), | 279 visit(type.returnType, converter), |
| 269 visitList(type.parameterTypes, converter), | 280 visitList(type.parameterTypes, converter), |
| 270 visitList(type.optionalParameterTypes, converter), | 281 visitList(type.optionalParameterTypes, converter), |
| 271 type.namedParameters, | 282 type.namedParameters, |
| 272 visitList(type.namedParameterTypes, converter)); | 283 visitList(type.namedParameterTypes, converter)); |
| 273 } | 284 } |
| 274 | 285 |
| 275 @override | 286 @override |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 final bool isAbstract; | 318 final bool isAbstract; |
| 308 | 319 |
| 309 JClass(this.library, this.classIndex, this.name, {this.isAbstract}); | 320 JClass(this.library, this.classIndex, this.name, {this.isAbstract}); |
| 310 | 321 |
| 311 @override | 322 @override |
| 312 bool get isClosure => false; | 323 bool get isClosure => false; |
| 313 | 324 |
| 314 String toString() => '${jsElementPrefix}class($name)'; | 325 String toString() => '${jsElementPrefix}class($name)'; |
| 315 } | 326 } |
| 316 | 327 |
| 328 class JTypedef implements TypedefEntity, IndexedTypedef { |
| 329 final JLibrary library; |
| 330 |
| 331 /// Typedef index used for fast lookup in [JsToFrontendMapImpl]. |
| 332 final int typedefIndex; |
| 333 |
| 334 final String name; |
| 335 |
| 336 JTypedef(this.library, this.typedefIndex, this.name); |
| 337 |
| 338 String toString() => '${jsElementPrefix}typedef($name)'; |
| 339 } |
| 340 |
| 317 abstract class JMember implements MemberEntity, IndexedMember { | 341 abstract class JMember implements MemberEntity, IndexedMember { |
| 318 /// Member index used for fast lookup in [JsToFrontendMapImpl]. | 342 /// Member index used for fast lookup in [JsToFrontendMapImpl]. |
| 319 final int memberIndex; | 343 final int memberIndex; |
| 320 final JLibrary library; | 344 final JLibrary library; |
| 321 final JClass enclosingClass; | 345 final JClass enclosingClass; |
| 322 final Name _name; | 346 final Name _name; |
| 323 final bool _isStatic; | 347 final bool _isStatic; |
| 324 | 348 |
| 325 JMember(this.memberIndex, this.library, this.enclosingClass, this._name, | 349 JMember(this.memberIndex, this.library, this.enclosingClass, this._name, |
| 326 {bool isStatic: false}) | 350 {bool isStatic: false}) |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 final Entity typeDeclaration; | 559 final Entity typeDeclaration; |
| 536 final String name; | 560 final String name; |
| 537 final int index; | 561 final int index; |
| 538 | 562 |
| 539 JTypeVariable( | 563 JTypeVariable( |
| 540 this.typeVariableIndex, this.typeDeclaration, this.name, this.index); | 564 this.typeVariableIndex, this.typeDeclaration, this.name, this.index); |
| 541 | 565 |
| 542 String toString() => | 566 String toString() => |
| 543 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; | 567 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; |
| 544 } | 568 } |
| OLD | NEW |