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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend_helpers.dart

Issue 2464103002: Introduce ClassLike, MemberLike, FieldLike and FunctionLike (Closed)
Patch Set: Created 4 years, 1 month 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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_backend.helpers; 5 library dart2js.js_backend.helpers;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Identifiers, Uris; 8 import '../common/names.dart' show Identifiers, Uris;
9 import '../common/resolution.dart' show Resolution; 9 import '../common/resolution.dart' show Resolution;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
11 import '../core_types.dart' show CoreClasses; 11 import '../core_types.dart' show CoreClasses;
12 import '../elements/elements.dart' 12 import '../elements/elements.dart'
13 show 13 show
14 AbstractFieldElement, 14 AbstractFieldElement,
15 ClassElement, 15 ClassElement,
16 ConstructorElement, 16 ConstructorElement,
17 Element, 17 Element,
18 EnumClassElement, 18 EnumClassElement,
19 FieldElement,
19 FunctionElement, 20 FunctionElement,
20 LibraryElement, 21 LibraryElement,
22 MemberElement,
21 MethodElement, 23 MethodElement,
22 PublicName; 24 PublicName;
23 import '../library_loader.dart' show LoadedLibraries; 25 import '../library_loader.dart' show LoadedLibraries;
24 import '../universe/call_structure.dart' show CallStructure; 26 import '../universe/call_structure.dart' show CallStructure;
25 import '../universe/selector.dart' show Selector; 27 import '../universe/selector.dart' show Selector;
26 import 'js_backend.dart'; 28 import 'js_backend.dart';
27 29
28 /// Helper classes and functions for the JavaScript backend. 30 /// Helper classes and functions for the JavaScript backend.
29 class BackendHelpers { 31 class BackendHelpers {
30 static final Uri DART_JS_HELPER = new Uri(scheme: 'dart', path: '_js_helper'); 32 static final Uri DART_JS_HELPER = new Uri(scheme: 'dart', path: '_js_helper');
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 ClassElement jsMutableIndexableClass; 95 ClassElement jsMutableIndexableClass;
94 96
95 ClassElement jsMutableArrayClass; 97 ClassElement jsMutableArrayClass;
96 ClassElement jsFixedArrayClass; 98 ClassElement jsFixedArrayClass;
97 ClassElement jsExtendableArrayClass; 99 ClassElement jsExtendableArrayClass;
98 ClassElement jsUnmodifiableArrayClass; 100 ClassElement jsUnmodifiableArrayClass;
99 ClassElement jsPositiveIntClass; 101 ClassElement jsPositiveIntClass;
100 ClassElement jsUInt32Class; 102 ClassElement jsUInt32Class;
101 ClassElement jsUInt31Class; 103 ClassElement jsUInt31Class;
102 104
103 Element jsIndexableLength; 105 MemberElement jsIndexableLength;
104 Element jsArrayTypedConstructor; 106 Element jsArrayTypedConstructor;
105 Element jsArrayRemoveLast; 107 MethodElement jsArrayRemoveLast;
106 Element jsArrayAdd; 108 MethodElement jsArrayAdd;
107 Element jsStringSplit; 109 MethodElement jsStringSplit;
108 Element jsStringToString; 110 Element jsStringToString;
109 Element jsStringOperatorAdd; 111 Element jsStringOperatorAdd;
110 Element objectEquals; 112 Element objectEquals;
111 113
112 ClassElement typeLiteralClass; 114 ClassElement typeLiteralClass;
113 ClassElement mapLiteralClass; 115 ClassElement mapLiteralClass;
114 ClassElement constMapLiteralClass; 116 ClassElement constMapLiteralClass;
115 ClassElement typeVariableClass; 117 ClassElement typeVariableClass;
116 ConstructorElement mapLiteralConstructor; 118 ConstructorElement mapLiteralConstructor;
117 ConstructorElement mapLiteralConstructorEmpty; 119 ConstructorElement mapLiteralConstructorEmpty;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 jsFixedArrayClass.ensureResolved(resolution); 361 jsFixedArrayClass.ensureResolved(resolution);
360 } 362 }
361 if (jsExtendableArrayClass != null) { 363 if (jsExtendableArrayClass != null) {
362 jsExtendableArrayClass.ensureResolved(resolution); 364 jsExtendableArrayClass.ensureResolved(resolution);
363 } 365 }
364 if (jsUnmodifiableArrayClass != null) { 366 if (jsUnmodifiableArrayClass != null) {
365 jsUnmodifiableArrayClass.ensureResolved(resolution); 367 jsUnmodifiableArrayClass.ensureResolved(resolution);
366 } 368 }
367 369
368 jsIndexableClass.ensureResolved(resolution); 370 jsIndexableClass.ensureResolved(resolution);
369 jsIndexableLength = compiler.lookupElementIn(jsIndexableClass, 'length'); 371 Element jsIndexableLengthElement =
370 if (jsIndexableLength != null && jsIndexableLength.isAbstractField) { 372 compiler.lookupElementIn(jsIndexableClass, 'length');
371 AbstractFieldElement element = jsIndexableLength; 373 if (jsIndexableLengthElement != null &&
374 jsIndexableLengthElement.isAbstractField) {
375 AbstractFieldElement element = jsIndexableLengthElement;
372 jsIndexableLength = element.getter; 376 jsIndexableLength = element.getter;
377 } else {
378 jsIndexableLength = jsIndexableLengthElement;
373 } 379 }
374 380
375 jsArrayClass.ensureResolved(resolution); 381 jsArrayClass.ensureResolved(resolution);
376 jsArrayTypedConstructor = compiler.lookupElementIn(jsArrayClass, 'typed'); 382 jsArrayTypedConstructor = compiler.lookupElementIn(jsArrayClass, 'typed');
377 jsArrayRemoveLast = compiler.lookupElementIn(jsArrayClass, 'removeLast'); 383 jsArrayRemoveLast = compiler.lookupElementIn(jsArrayClass, 'removeLast');
378 jsArrayAdd = compiler.lookupElementIn(jsArrayClass, 'add'); 384 jsArrayAdd = compiler.lookupElementIn(jsArrayClass, 'add');
379 385
380 jsStringClass.ensureResolved(resolution); 386 jsStringClass.ensureResolved(resolution);
381 jsStringSplit = compiler.lookupElementIn(jsStringClass, 'split'); 387 jsStringSplit = compiler.lookupElementIn(jsStringClass, 'split');
382 jsStringOperatorAdd = compiler.lookupElementIn(jsStringClass, '+'); 388 jsStringOperatorAdd = compiler.lookupElementIn(jsStringClass, '+');
383 jsStringToString = compiler.lookupElementIn(jsStringClass, 'toString'); 389 jsStringToString = compiler.lookupElementIn(jsStringClass, 'toString');
384 390
385 objectEquals = compiler.lookupElementIn(coreClasses.objectClass, '=='); 391 objectEquals = compiler.lookupElementIn(coreClasses.objectClass, '==');
386 } 392 }
387 393
388 Element get badMain { 394 Element get badMain {
389 return findHelper('badMain'); 395 return findHelper('badMain');
390 } 396 }
391 397
392 Element get missingMain { 398 Element get missingMain {
393 return findHelper('missingMain'); 399 return findHelper('missingMain');
394 } 400 }
395 401
396 Element get mainHasTooManyParameters { 402 Element get mainHasTooManyParameters {
397 return findHelper('mainHasTooManyParameters'); 403 return findHelper('mainHasTooManyParameters');
398 } 404 }
399 405
400 Element get loadLibraryWrapper { 406 MethodElement get loadLibraryWrapper {
401 return findHelper("_loadLibraryWrapper"); 407 return findHelper("_loadLibraryWrapper");
402 } 408 }
403 409
404 Element get boolConversionCheck { 410 Element get boolConversionCheck {
405 return findHelper('boolConversionCheck'); 411 return findHelper('boolConversionCheck');
406 } 412 }
407 413
408 Element get consoleTraceHelper { 414 Element get consoleTraceHelper {
409 return findHelper('consoleTraceHelper'); 415 return findHelper('consoleTraceHelper');
410 } 416 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 MethodElement _objectNoSuchMethod; 718 MethodElement _objectNoSuchMethod;
713 719
714 MethodElement get objectNoSuchMethod { 720 MethodElement get objectNoSuchMethod {
715 if (_objectNoSuchMethod == null) { 721 if (_objectNoSuchMethod == null) {
716 _objectNoSuchMethod = 722 _objectNoSuchMethod =
717 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_); 723 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_);
718 } 724 }
719 return _objectNoSuchMethod; 725 return _objectNoSuchMethod;
720 } 726 }
721 } 727 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698