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

Unified Diff: pkg/analyzer/lib/src/summary/format.dart

Issue 1713753002: Allow linked types to refer to local executables. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/analyzer/lib/src/summary/format.dart
diff --git a/pkg/analyzer/lib/src/summary/format.dart b/pkg/analyzer/lib/src/summary/format.dart
index 7ffdf441c4ce8c5c7c3b6bc5ad9ef34b0b5acb18..5a029985c738b885aaff83e10e1f29d836db1943 100644
--- a/pkg/analyzer/lib/src/summary/format.dart
+++ b/pkg/analyzer/lib/src/summary/format.dart
@@ -730,6 +730,7 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
int _containingReference;
int _dependency;
idl.ReferenceKind _kind;
+ int _localIndex;
String _name;
int _numTypeParameters;
int _unit;
@@ -783,6 +784,22 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
}
@override
+ int get localIndex => _localIndex ??= 0;
+
+ /**
+ * If [kind] is [ReferenceKind.function] (that is, the entity being referred
+ * to is a local function), the index of the function within
+ * [UnlinkedExecutable.localFunctions]. If [kind] is
+ * [ReferenceKind.variable], the index of the variable within
+ * [UnlinkedExecutable.localVariables]. Otherwise zero.
+ */
+ void set localIndex(int _value) {
+ assert(!_finished);
+ assert(_value == null || _value >= 0);
+ _localIndex = _value;
+ }
+
+ @override
String get name => _name ??= '';
/**
@@ -826,10 +843,11 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
_unit = _value;
}
- LinkedReferenceBuilder({int containingReference, int dependency, idl.ReferenceKind kind, String name, int numTypeParameters, int unit})
+ LinkedReferenceBuilder({int containingReference, int dependency, idl.ReferenceKind kind, int localIndex, String name, int numTypeParameters, int unit})
: _containingReference = containingReference,
_dependency = dependency,
_kind = kind,
+ _localIndex = localIndex,
_name = name,
_numTypeParameters = numTypeParameters,
_unit = unit;
@@ -851,6 +869,9 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
if (_kind != null && _kind != idl.ReferenceKind.classOrEnum) {
fbBuilder.addUint8(2, _kind.index);
}
+ if (_localIndex != null && _localIndex != 0) {
+ fbBuilder.addUint32(6, _localIndex);
+ }
if (offset_name != null) {
fbBuilder.addOffset(3, offset_name);
}
@@ -879,6 +900,7 @@ class _LinkedReferenceImpl extends Object with _LinkedReferenceMixin implements
int _containingReference;
int _dependency;
idl.ReferenceKind _kind;
+ int _localIndex;
String _name;
int _numTypeParameters;
int _unit;
@@ -902,6 +924,12 @@ class _LinkedReferenceImpl extends Object with _LinkedReferenceMixin implements
}
@override
+ int get localIndex {
+ _localIndex ??= const fb.Uint32Reader().vTableGet(_bp, 6, 0);
+ return _localIndex;
+ }
+
+ @override
String get name {
_name ??= const fb.StringReader().vTableGet(_bp, 3, '');
return _name;
@@ -926,6 +954,7 @@ abstract class _LinkedReferenceMixin implements idl.LinkedReference {
"containingReference": containingReference,
"dependency": dependency,
"kind": kind,
+ "localIndex": localIndex,
"name": name,
"numTypeParameters": numTypeParameters,
"unit": unit,
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/idl.dart » ('j') | pkg/analyzer/lib/src/summary/resynthesize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698