Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: pkg/compiler/lib/src/js_model/elements.dart

Issue 2975433002: Assert that we don't mix K and J elements (Closed)
Patch Set: Updated cf. comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_elements.dart'; 7 import '../common_elements.dart';
8 import '../constants/constant_system.dart'; 8 import '../constants/constant_system.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../elements/entities.dart'; 10 import '../elements/entities.dart';
11 import '../elements/names.dart'; 11 import '../elements/names.dart';
12 import '../elements/types.dart'; 12 import '../elements/types.dart';
13 import '../js_backend/backend_usage.dart'; 13 import '../js_backend/backend_usage.dart';
14 import '../js_backend/interceptor_data.dart'; 14 import '../js_backend/interceptor_data.dart';
15 import '../js_backend/native_data.dart'; 15 import '../js_backend/native_data.dart';
16 import '../js_backend/runtime_types.dart';
16 import '../kernel/elements.dart'; 17 import '../kernel/elements.dart';
17 import '../kernel/element_map_impl.dart'; 18 import '../kernel/element_map_impl.dart';
18 import '../native/behavior.dart'; 19 import '../native/behavior.dart';
19 import '../universe/class_set.dart'; 20 import '../universe/class_set.dart';
20 import '../world.dart'; 21 import '../world.dart';
21 22
22 /// Bidirectional map between 'frontend' and 'backend' elements. 23 /// Bidirectional map between 'frontend' and 'backend' elements.
23 /// 24 ///
24 /// Frontend elements are what we read in, these typically represents concepts 25 /// Frontend elements are what we read in, these typically represents concepts
25 /// in Dart. Backend elements are what we generate, these may include elements 26 /// in Dart. Backend elements are what we generate, these may include elements
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 TypeVariableType type, EntityConverter converter) { 253 TypeVariableType type, EntityConverter converter) {
253 return new TypeVariableType(converter(type.element)); 254 return new TypeVariableType(converter(type.element));
254 } 255 }
255 256
256 @override 257 @override
257 DartType visitVoidType(VoidType type, EntityConverter converter) { 258 DartType visitVoidType(VoidType type, EntityConverter converter) {
258 return const VoidType(); 259 return const VoidType();
259 } 260 }
260 } 261 }
261 262
262 const String jsElementPrefix = 'j'; 263 const String jsElementPrefix = 'j:';
263 264
264 class JLibrary implements LibraryEntity, IndexedLibrary { 265 class JLibrary implements LibraryEntity, IndexedLibrary {
265 /// Library index used for fast lookup in [JsToFrontendMapImpl]. 266 /// Library index used for fast lookup in [JsToFrontendMapImpl].
266 final int libraryIndex; 267 final int libraryIndex;
267 final String name; 268 final String name;
268 final Uri canonicalUri; 269 final Uri canonicalUri;
269 270
270 JLibrary(this.libraryIndex, this.name, this.canonicalUri); 271 JLibrary(this.libraryIndex, this.name, this.canonicalUri);
271 272
272 String toString() => '${jsElementPrefix}library($name)'; 273 String toString() => '${jsElementPrefix}library($name)';
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 487
487 JTypeVariable( 488 JTypeVariable(
488 this.typeVariableIndex, this.typeDeclaration, this.name, this.index); 489 this.typeVariableIndex, this.typeDeclaration, this.name, this.index);
489 490
490 String toString() => 491 String toString() =>
491 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; 492 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)';
492 } 493 }
493 494
494 class JsClosedWorld extends ClosedWorldBase with KernelClosedWorldMixin { 495 class JsClosedWorld extends ClosedWorldBase with KernelClosedWorldMixin {
495 final JsKernelToElementMap elementMap; 496 final JsKernelToElementMap elementMap;
497 final RuntimeTypesNeed rtiNeed;
496 498
497 JsClosedWorld(this.elementMap, 499 JsClosedWorld(this.elementMap,
498 {ElementEnvironment elementEnvironment, 500 {ElementEnvironment elementEnvironment,
499 DartTypes dartTypes, 501 DartTypes dartTypes,
500 CommonElements commonElements, 502 CommonElements commonElements,
501 ConstantSystem constantSystem, 503 ConstantSystem constantSystem,
502 NativeData nativeData, 504 NativeData nativeData,
503 InterceptorData interceptorData, 505 InterceptorData interceptorData,
504 BackendUsage backendUsage, 506 BackendUsage backendUsage,
507 this.rtiNeed,
505 Set<ClassEntity> implementedClasses, 508 Set<ClassEntity> implementedClasses,
509 Iterable<ClassEntity> liveNativeClasses,
506 Iterable<MemberEntity> liveInstanceMembers, 510 Iterable<MemberEntity> liveInstanceMembers,
507 Iterable<MemberEntity> assignedInstanceMembers, 511 Iterable<MemberEntity> assignedInstanceMembers,
508 Set<TypedefElement> allTypedefs, 512 Set<TypedefElement> allTypedefs,
509 Map<ClassEntity, Set<ClassEntity>> mixinUses, 513 Map<ClassEntity, Set<ClassEntity>> mixinUses,
510 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, 514 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses,
511 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes, 515 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes,
512 Map<ClassEntity, ClassSet> classSets}) 516 Map<ClassEntity, ClassSet> classSets})
513 : super( 517 : super(
514 elementEnvironment, 518 elementEnvironment,
515 dartTypes, 519 dartTypes,
516 commonElements, 520 commonElements,
517 constantSystem, 521 constantSystem,
518 nativeData, 522 nativeData,
519 interceptorData, 523 interceptorData,
520 backendUsage, 524 backendUsage,
521 implementedClasses, 525 implementedClasses,
526 liveNativeClasses,
522 liveInstanceMembers, 527 liveInstanceMembers,
523 assignedInstanceMembers, 528 assignedInstanceMembers,
524 allTypedefs, 529 allTypedefs,
525 mixinUses, 530 mixinUses,
526 typesImplementedBySubclasses, 531 typesImplementedBySubclasses,
527 classHierarchyNodes, 532 classHierarchyNodes,
528 classSets); 533 classSets);
529 534
530 @override 535 @override
531 void registerClosureClass(ClassElement cls) { 536 void registerClosureClass(ClassElement cls) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 699
695 @override 700 @override
696 bool get isFunctionApplyUsed => _backendUsage.isFunctionApplyUsed; 701 bool get isFunctionApplyUsed => _backendUsage.isFunctionApplyUsed;
697 702
698 @override 703 @override
699 bool get isMirrorsUsed => _backendUsage.isMirrorsUsed; 704 bool get isMirrorsUsed => _backendUsage.isMirrorsUsed;
700 705
701 @override 706 @override
702 bool get isNoSuchMethodUsed => _backendUsage.isNoSuchMethodUsed; 707 bool get isNoSuchMethodUsed => _backendUsage.isNoSuchMethodUsed;
703 } 708 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart ('k') | pkg/compiler/lib/src/js_model/js_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698