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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/serialization/modelz.dart
diff --git a/pkg/compiler/lib/src/serialization/modelz.dart b/pkg/compiler/lib/src/serialization/modelz.dart
index 7c02c7a07ff7ed1af5af18c28b1c871869cf4c34..b67f7c52669a89329650b00ac9971fea148d3c6d 100644
--- a/pkg/compiler/lib/src/serialization/modelz.dart
+++ b/pkg/compiler/lib/src/serialization/modelz.dart
@@ -453,7 +453,10 @@ class LibraryElementZ extends DeserializedElementZ
}
@override
- Element findExported(String elementName) => _unsupported('findExported');
+ Element findExported(String elementName) {
+ _ensureExports();
+ return _exportsMap.lookup(elementName);
+ }
void _ensureImports() {
if (_importsMap == null) {
@@ -1338,6 +1341,14 @@ class StaticFieldElementZ extends FieldElementZ
: super(decoder);
}
+class EnumConstantElementZ extends StaticFieldElementZ
+ implements EnumConstantElement {
+ EnumConstantElementZ(ObjectDecoder decoder)
+ : super(decoder);
+
+ int get index => _decoder.getInt(Key.INDEX);
+}
+
class InstanceFieldElementZ extends FieldElementZ
with ClassMemberMixin, InstanceMemberMixin {
InstanceFieldElementZ(ObjectDecoder decoder)
@@ -1834,6 +1845,48 @@ class InitializingFormalElementZ extends ParameterElementZ
ElementKind get kind => ElementKind.INITIALIZING_FORMAL;
}
+
+class LocalVariableElementZ extends DeserializedElementZ
+ with
+ AnalyzableElementMixin,
+ AstElementMixin,
+ LocalExecutableMixin,
+ TypedElementMixin
+ implements LocalVariableElement {
+ bool _isConst;
+ ConstantExpression _constant;
+
+ LocalVariableElementZ(ObjectDecoder decoder) : super(decoder);
+
+ @override
+ accept(ElementVisitor visitor, arg) {
+ return visitor.visitLocalVariableElement(this, arg);
+ }
+
+ @override
+ ElementKind get kind => ElementKind.VARIABLE;
+
+ @override
+ bool get isConst {
+ if (_isConst == null) {
+ _constant = _decoder.getConstant(Key.CONSTANT);
+ _isConst = _constant != null;
+ }
+ return _isConst;
+ }
+
+ @override
+ ConstantExpression get constant {
+ if (isConst) {
+ return _constant;
+ }
+ return null;
+ }
+
+ @override
+ Expression get initializer => _unsupported('initializer');
+}
+
class ImportElementZ extends DeserializedElementZ
with LibraryMemberMixin implements ImportElement {
bool _isDeferred;

Powered by Google App Engine
This is Rietveld 408576698