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

Side by Side Diff: pkg/compiler/lib/src/serialization/modelz.dart

Issue 1873823002: Update elements, nodes and visitors for serialization. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix LocalVariableElementZ.constant Created 4 years, 8 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) 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 /// Implementation of the element model used for deserialiation. 5 /// Implementation of the element model used for deserialiation.
6 /// 6 ///
7 /// These classes are created by [ElementDeserializer] triggered by the 7 /// These classes are created by [ElementDeserializer] triggered by the
8 /// [Deserializer]. 8 /// [Deserializer].
9 9
10 library dart2js.serialization.modelz; 10 library dart2js.serialization.modelz;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 446 }
447 return element; 447 return element;
448 } 448 }
449 449
450 @override 450 @override
451 Element findLocal(String elementName) { 451 Element findLocal(String elementName) {
452 return localLookup(elementName); 452 return localLookup(elementName);
453 } 453 }
454 454
455 @override 455 @override
456 Element findExported(String elementName) => _unsupported('findExported'); 456 Element findExported(String elementName) {
457 _ensureExports();
458 return _exportsMap.lookup(elementName);
459 }
457 460
458 void _ensureImports() { 461 void _ensureImports() {
459 if (_importsMap == null) { 462 if (_importsMap == null) {
460 _importsMap = new ListedContainer(_decoder.getElements(Key.IMPORT_SCOPE)); 463 _importsMap = new ListedContainer(_decoder.getElements(Key.IMPORT_SCOPE));
461 } 464 }
462 } 465 }
463 466
464 @override 467 @override
465 void forEachImport(f(Element element)) { 468 void forEachImport(f(Element element)) {
466 _ensureImports(); 469 _ensureImports();
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 TopLevelFieldElementZ(ObjectDecoder decoder) 1334 TopLevelFieldElementZ(ObjectDecoder decoder)
1332 : super(decoder); 1335 : super(decoder);
1333 } 1336 }
1334 1337
1335 class StaticFieldElementZ extends FieldElementZ 1338 class StaticFieldElementZ extends FieldElementZ
1336 with ClassMemberMixin, StaticMemberMixin { 1339 with ClassMemberMixin, StaticMemberMixin {
1337 StaticFieldElementZ(ObjectDecoder decoder) 1340 StaticFieldElementZ(ObjectDecoder decoder)
1338 : super(decoder); 1341 : super(decoder);
1339 } 1342 }
1340 1343
1344 class EnumConstantElementZ extends StaticFieldElementZ
1345 implements EnumConstantElement {
1346 EnumConstantElementZ(ObjectDecoder decoder)
1347 : super(decoder);
1348
1349 int get index => _decoder.getInt(Key.INDEX);
1350 }
1351
1341 class InstanceFieldElementZ extends FieldElementZ 1352 class InstanceFieldElementZ extends FieldElementZ
1342 with ClassMemberMixin, InstanceMemberMixin { 1353 with ClassMemberMixin, InstanceMemberMixin {
1343 InstanceFieldElementZ(ObjectDecoder decoder) 1354 InstanceFieldElementZ(ObjectDecoder decoder)
1344 : super(decoder); 1355 : super(decoder);
1345 } 1356 }
1346 1357
1347 abstract class FunctionElementZ extends DeserializedElementZ 1358 abstract class FunctionElementZ extends DeserializedElementZ
1348 with AnalyzableElementMixin, 1359 with AnalyzableElementMixin,
1349 AstElementMixin, 1360 AstElementMixin,
1350 ParametersMixin, 1361 ParametersMixin,
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 1838
1828 @override 1839 @override
1829 accept(ElementVisitor visitor, arg) { 1840 accept(ElementVisitor visitor, arg) {
1830 return visitor.visitFieldParameterElement(this, arg); 1841 return visitor.visitFieldParameterElement(this, arg);
1831 } 1842 }
1832 1843
1833 @override 1844 @override
1834 ElementKind get kind => ElementKind.INITIALIZING_FORMAL; 1845 ElementKind get kind => ElementKind.INITIALIZING_FORMAL;
1835 } 1846 }
1836 1847
1848
1849 class LocalVariableElementZ extends DeserializedElementZ
1850 with
1851 AnalyzableElementMixin,
1852 AstElementMixin,
1853 LocalExecutableMixin,
1854 TypedElementMixin
1855 implements LocalVariableElement {
1856 bool _isConst;
1857 ConstantExpression _constant;
1858
1859 LocalVariableElementZ(ObjectDecoder decoder) : super(decoder);
1860
1861 @override
1862 accept(ElementVisitor visitor, arg) {
1863 return visitor.visitLocalVariableElement(this, arg);
1864 }
1865
1866 @override
1867 ElementKind get kind => ElementKind.VARIABLE;
1868
1869 @override
1870 bool get isConst {
1871 if (_isConst == null) {
1872 _constant = _decoder.getConstant(Key.CONSTANT);
1873 _isConst = _constant != null;
1874 }
1875 return _isConst;
1876 }
1877
1878 @override
1879 ConstantExpression get constant {
1880 if (isConst) {
1881 return _constant;
1882 }
1883 return null;
1884 }
1885
1886 @override
1887 Expression get initializer => _unsupported('initializer');
1888 }
1889
1837 class ImportElementZ extends DeserializedElementZ 1890 class ImportElementZ extends DeserializedElementZ
1838 with LibraryMemberMixin implements ImportElement { 1891 with LibraryMemberMixin implements ImportElement {
1839 bool _isDeferred; 1892 bool _isDeferred;
1840 PrefixElement _prefix; 1893 PrefixElement _prefix;
1841 LibraryElement _importedLibrary; 1894 LibraryElement _importedLibrary;
1842 Uri _uri; 1895 Uri _uri;
1843 1896
1844 ImportElementZ(ObjectDecoder decoder) 1897 ImportElementZ(ObjectDecoder decoder)
1845 : super(decoder); 1898 : super(decoder);
1846 1899
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 } 2017 }
1965 2018
1966 @override 2019 @override
1967 ElementKind get kind => ElementKind.PREFIX; 2020 ElementKind get kind => ElementKind.PREFIX;
1968 2021
1969 @override 2022 @override
1970 Element lookupLocalMember(String memberName) { 2023 Element lookupLocalMember(String memberName) {
1971 return _unsupported('lookupLocalMember'); 2024 return _unsupported('lookupLocalMember');
1972 } 2025 }
1973 } 2026 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698