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

Unified Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2456643006: More functionality in kernel_impact. (Closed)
Patch Set: Fix errors. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/kernel_impact.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
index 0b54193ad356ab74e563f6de983d88c93ca8e20f..a31929f8cb1ffc7ff2fa97902adfaf1348ac6d8d 100644
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
@@ -12,6 +12,7 @@ import '../dart_types.dart';
import '../elements/elements.dart';
import '../js_backend/js_backend.dart';
import '../kernel/kernel.dart';
+import '../kernel/kernel_debug.dart';
import '../resolution/tree_elements.dart';
import '../tree/tree.dart' as ast;
import '../types/masks.dart';
@@ -61,6 +62,7 @@ class KernelAstAdapter {
TreeElements get elements => _resolvedAst.elements;
GlobalTypeInferenceResults get _inferenceResults =>
_compiler.globalInference.results;
+ DiagnosticReporter get reporter => _compiler.reporter;
ConstantValue getConstantForSymbol(ir.SymbolLiteral node) {
ast.Node astNode = getNode(node);
@@ -73,7 +75,8 @@ class KernelAstAdapter {
Element getElement(ir.Node node) {
Element result = _nodeToElement[node];
- assert(result != null);
+ assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null,
+ message: "No element found for $node."));
return result;
}
@@ -295,7 +298,19 @@ class DartTypeConverter extends ir.DartTypeVisitor<DartType> {
@override
DartType visitTypeParameterType(ir.TypeParameterType node) {
- return new TypeVariableType(astAdapter.getElement(node.parameter));
+ if (node.parameter.parent is ir.Class) {
+ ir.Class cls = node.parameter.parent;
+ int index = cls.typeParameters.indexOf(node.parameter);
+ ClassElement classElement = astAdapter.getElement(cls);
+ return classElement.typeVariables[index];
+ } else if (node.parameter.parent is ir.FunctionNode) {
+ ir.FunctionNode func = node.parameter.parent;
+ int index = func.typeParameters.indexOf(node.parameter);
+ ConstructorElement constructorElement = astAdapter.getElement(func);
+ ClassElement classElement = constructorElement.enclosingClass;
+ return classElement.typeVariables[index];
+ }
+ throw new UnsupportedError('Unsupported type parameter type node $node.');
}
@override
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/kernel_impact.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698