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

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

Issue 1674073002: Add UnlinkedConst.isValid and set it during summarizing. (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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/idl.dart » ('j') | pkg/analyzer/lib/src/summary/idl.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4dc69dc7e194947bed0fb696e4adc0120baf2d9e..020e4faa926cea3a4b2bc4c5514e9e9dc06d7ef0 100644
--- a/pkg/analyzer/lib/src/summary/format.dart
+++ b/pkg/analyzer/lib/src/summary/format.dart
@@ -1623,6 +1623,7 @@ abstract class _UnlinkedCombinatorMixin implements idl.UnlinkedCombinator {
class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements idl.UnlinkedConst {
bool _finished = false;
+ bool _isValid;
List<idl.UnlinkedConstOperation> _operations;
List<int> _ints;
List<double> _doubles;
@@ -1630,6 +1631,18 @@ class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id
List<EntityRefBuilder> _references;
@override
+ bool get isValid => _isValid ??= false;
+
+ /**
+ * Indicates whether the expression is a valid potentially constant
+ * expression.
+ */
+ void set isValid(bool _value) {
+ assert(!_finished);
+ _isValid = _value;
+ }
+
+ @override
List<idl.UnlinkedConstOperation> get operations => _operations ??= <idl.UnlinkedConstOperation>[];
/**
@@ -1692,8 +1705,9 @@ class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id
_references = _value;
}
- UnlinkedConstBuilder({List<idl.UnlinkedConstOperation> operations, List<int> ints, List<double> doubles, List<String> strings, List<EntityRefBuilder> references})
- : _operations = operations,
+ UnlinkedConstBuilder({bool isValid, List<idl.UnlinkedConstOperation> operations, List<int> ints, List<double> doubles, List<String> strings, List<EntityRefBuilder> references})
+ : _isValid = isValid,
+ _operations = operations,
_ints = ints,
_doubles = doubles,
_strings = strings,
@@ -1723,20 +1737,23 @@ class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id
offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fbBuilder)).toList());
}
fbBuilder.startTable();
+ if (_isValid == true) {
+ fbBuilder.addBool(0, true);
+ }
if (offset_operations != null) {
- fbBuilder.addOffset(0, offset_operations);
+ fbBuilder.addOffset(1, offset_operations);
}
if (offset_ints != null) {
- fbBuilder.addOffset(1, offset_ints);
+ fbBuilder.addOffset(2, offset_ints);
}
if (offset_doubles != null) {
- fbBuilder.addOffset(2, offset_doubles);
+ fbBuilder.addOffset(3, offset_doubles);
}
if (offset_strings != null) {
- fbBuilder.addOffset(3, offset_strings);
+ fbBuilder.addOffset(4, offset_strings);
}
if (offset_references != null) {
- fbBuilder.addOffset(4, offset_references);
+ fbBuilder.addOffset(5, offset_references);
}
return fbBuilder.endTable();
}
@@ -1754,6 +1771,7 @@ class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl.
_UnlinkedConstImpl(this._bp);
+ bool _isValid;
List<idl.UnlinkedConstOperation> _operations;
List<int> _ints;
List<double> _doubles;
@@ -1761,32 +1779,38 @@ class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl.
List<idl.EntityRef> _references;
@override
+ bool get isValid {
+ _isValid ??= const fb.BoolReader().vTableGet(_bp, 0, false);
+ return _isValid;
+ }
+
+ @override
List<idl.UnlinkedConstOperation> get operations {
- _operations ??= const fb.ListReader<idl.UnlinkedConstOperation>(const _UnlinkedConstOperationReader()).vTableGet(_bp, 0, const <idl.UnlinkedConstOperation>[]);
+ _operations ??= const fb.ListReader<idl.UnlinkedConstOperation>(const _UnlinkedConstOperationReader()).vTableGet(_bp, 1, const <idl.UnlinkedConstOperation>[]);
return _operations;
}
@override
List<int> get ints {
- _ints ??= const fb.ListReader<int>(const fb.Uint32Reader()).vTableGet(_bp, 1, const <int>[]);
+ _ints ??= const fb.ListReader<int>(const fb.Uint32Reader()).vTableGet(_bp, 2, const <int>[]);
return _ints;
}
@override
List<double> get doubles {
- _doubles ??= const fb.Float64ListReader().vTableGet(_bp, 2, const <double>[]);
+ _doubles ??= const fb.Float64ListReader().vTableGet(_bp, 3, const <double>[]);
return _doubles;
}
@override
List<String> get strings {
- _strings ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bp, 3, const <String>[]);
+ _strings ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bp, 4, const <String>[]);
return _strings;
}
@override
List<idl.EntityRef> get references {
- _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader()).vTableGet(_bp, 4, const <idl.EntityRef>[]);
+ _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader()).vTableGet(_bp, 5, const <idl.EntityRef>[]);
return _references;
}
}
@@ -1794,6 +1818,7 @@ class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl.
abstract class _UnlinkedConstMixin implements idl.UnlinkedConst {
@override
Map<String, Object> toMap() => {
+ "isValid": isValid,
"operations": operations,
"ints": ints,
"doubles": doubles,
@@ -3154,8 +3179,9 @@ class UnlinkedParamBuilder extends Object with _UnlinkedParamMixin implements id
UnlinkedConstBuilder get defaultValue => _defaultValue;
/**
- * If the parameter has a default value the constant expression in the
- * default value.
+ * If the parameter has a default value, the constant expression in the
+ * default value. Note that the presence of this expression does not mean
+ * that it is a valid , check [UnlinkedConst.isValid].
*/
void set defaultValue(UnlinkedConstBuilder _value) {
assert(!_finished);
@@ -4587,7 +4613,8 @@ class UnlinkedVariableBuilder extends Object with _UnlinkedVariableMixin impleme
/**
* If [isConst] is true, and the variable has an initializer, the constant
- * expression in the initializer.
+ * expression in the initializer. Note that the presence of this expression
+ * does not mean that it is a valid, check [UnlinkedConst.isValid].
*/
void set constExpr(UnlinkedConstBuilder _value) {
assert(!_finished);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/idl.dart » ('j') | pkg/analyzer/lib/src/summary/idl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698