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

Unified Diff: pkg/compiler/lib/src/tree/nodes.dart

Issue 2638063003: Reverts the following two commits: (Closed)
Patch Set: Created 3 years, 11 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 | « pkg/compiler/lib/src/tokens/token.dart ('k') | pkg/compiler/lib/src/tree/prettyprint.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/tree/nodes.dart
diff --git a/pkg/compiler/lib/src/tree/nodes.dart b/pkg/compiler/lib/src/tree/nodes.dart
index 3ef0fb36cdbd320122c384c603c2696984e76c38..1e5f9ddbdd41e6e4b2cf65bb0957ce6282f35458 100644
--- a/pkg/compiler/lib/src/tree/nodes.dart
+++ b/pkg/compiler/lib/src/tree/nodes.dart
@@ -48,10 +48,6 @@ abstract class Visitor<R> {
R visitForIn(ForIn node) => visitLoop(node);
R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node);
R visitFunctionExpression(FunctionExpression node) => visitExpression(node);
- R visitFunctionTypeAnnotation(FunctionTypeAnnotation node) {
- return visitTypeAnnotation(node);
- }
-
R visitGotoStatement(GotoStatement node) => visitStatement(node);
R visitIdentifier(Identifier node) => visitExpression(node);
R visitImport(Import node) => visitLibraryDependency(node);
@@ -83,10 +79,6 @@ abstract class Visitor<R> {
R visitNewExpression(NewExpression node) => visitExpression(node);
R visitNodeList(NodeList node) => visitNode(node);
- R visitNominalTypeAnnotation(NominalTypeAnnotation node) {
- return visitTypeAnnotation(node);
- }
-
R visitOperator(Operator node) => visitIdentifier(node);
R visitParenthesizedExpression(ParenthesizedExpression node) {
return visitExpression(node);
@@ -184,10 +176,6 @@ abstract class Visitor1<R, A> {
return visitExpression(node, arg);
}
- R visitFunctionTypeAnnotation(FunctionTypeAnnotation node, A arg) {
- return visitTypeAnnotation(node, arg);
- }
-
R visitGotoStatement(GotoStatement node, A arg) {
return visitStatement(node, arg);
}
@@ -237,10 +225,6 @@ abstract class Visitor1<R, A> {
R visitNewExpression(NewExpression node, A arg) => visitExpression(node, arg);
R visitNodeList(NodeList node, A arg) => visitNode(node, arg);
- R visitNominalTypeAnnotation(NominalTypeAnnotation node, A arg) {
- visitTypeAnnotation(node, arg);
- }
-
R visitOperator(Operator node, A arg) => visitIdentifier(node, arg);
R visitParenthesizedExpression(ParenthesizedExpression node, A arg) {
return visitExpression(node, arg);
@@ -276,8 +260,8 @@ abstract class Visitor1<R, A> {
R visitLiteralSymbol(LiteralSymbol node, A arg) => visitExpression(node, arg);
R visitThrow(Throw node, A arg) => visitExpression(node, arg);
R visitTryStatement(TryStatement node, A arg) => visitStatement(node, arg);
- R visitTypedef(Typedef node, A arg) => visitNode(node, arg);
R visitTypeAnnotation(TypeAnnotation node, A arg) => visitNode(node, arg);
+ R visitTypedef(Typedef node, A arg) => visitNode(node, arg);
R visitTypeVariable(TypeVariable node, A arg) => visitNode(node, arg);
R visitVariableDefinitions(VariableDefinitions node, A arg) {
return visitStatement(node, arg);
@@ -376,7 +360,6 @@ abstract class Node extends NullTreeElementMixin implements Spannable {
ForIn asForIn() => null;
FunctionDeclaration asFunctionDeclaration() => null;
FunctionExpression asFunctionExpression() => null;
- FunctionTypeAnnotation asFunctionTypeAnnotation() => null;
Identifier asIdentifier() => null;
If asIf() => null;
Import asImport() => null;
@@ -400,7 +383,6 @@ abstract class Node extends NullTreeElementMixin implements Spannable {
NamedMixinApplication asNamedMixinApplication() => null;
NewExpression asNewExpression() => null;
NodeList asNodeList() => null;
- NominalTypeAnnotation asNominalTypeAnnotation() => null;
Operator asOperator() => null;
ParenthesizedExpression asParenthesizedExpression() => null;
Part asPart() => null;
@@ -419,6 +401,7 @@ abstract class Node extends NullTreeElementMixin implements Spannable {
SwitchStatement asSwitchStatement() => null;
Throw asThrow() => null;
TryStatement asTryStatement() => null;
+ TypeAnnotation asTypeAnnotation() => null;
TypeVariable asTypeVariable() => null;
Typedef asTypedef() => null;
VariableDefinitions asVariableDefinitions() => null;
@@ -503,7 +486,7 @@ class ClassNode extends Node {
}
class MixinApplication extends Node {
- final NominalTypeAnnotation superclass;
+ final TypeAnnotation superclass;
final NodeList mixins;
MixinApplication(this.superclass, this.mixins);
@@ -528,6 +511,8 @@ class MixinApplication extends Node {
Token getEndToken() => mixins.getEndToken();
}
+// TODO(kasperl): Let this share some structure with the typedef for function
+// type aliases?
class NamedMixinApplication extends Node implements MixinApplication {
final Identifier name;
final NodeList typeParameters;
@@ -542,7 +527,7 @@ class NamedMixinApplication extends Node implements MixinApplication {
NamedMixinApplication(this.name, this.typeParameters, this.modifiers,
this.mixinApplication, this.interfaces, this.classKeyword, this.endToken);
- NominalTypeAnnotation get superclass => mixinApplication.superclass;
+ TypeAnnotation get superclass => mixinApplication.superclass;
NodeList get mixins => mixinApplication.mixins;
MixinApplication asMixinApplication() => this;
@@ -1735,22 +1720,17 @@ class Rethrow extends Statement {
Token getEndToken() => endToken;
}
-abstract class TypeAnnotation extends Node {
-}
-
-class NominalTypeAnnotation extends TypeAnnotation {
+class TypeAnnotation extends Node {
final Expression typeName;
final NodeList typeArguments;
- NominalTypeAnnotation(this.typeName, this.typeArguments);
+ TypeAnnotation(Expression this.typeName, NodeList this.typeArguments);
- NominalTypeAnnotation asNominalTypeAnnotation() => this;
+ TypeAnnotation asTypeAnnotation() => this;
- accept(Visitor visitor) => visitor.visitNominalTypeAnnotation(this);
+ accept(Visitor visitor) => visitor.visitTypeAnnotation(this);
- accept1(Visitor1 visitor, arg) {
- return visitor.visitNominalTypeAnnotation(this, arg);
- }
+ accept1(Visitor1 visitor, arg) => visitor.visitTypeAnnotation(this, arg);
visitChildren(Visitor visitor) {
typeName.accept(visitor);
@@ -1846,13 +1826,7 @@ class VariableDefinitions extends Statement {
return token;
}
- Token getEndToken() {
- var result = definitions.getEndToken();
- if (result != null) return result;
- assert(definitions.nodes.length == 1);
- assert(definitions.nodes.last == null);
- return type.getEndToken();
- }
+ Token getEndToken() => definitions.getEndToken();
}
abstract class Loop extends Statement {
@@ -2880,30 +2854,16 @@ class Combinator extends Node {
}
class Typedef extends Node {
- final bool isGeneralizedTypeAlias;
-
- /// Parameters to the template.
- ///
- /// For example, `T` and `S` are template parameters in the following
- /// typedef: `typedef F<S, T> = Function(S, T)`, or, in the inlined syntax,
- /// `typedef F<S, T>(S x, T y)`.
- final NodeList templateParameters;
-
final TypeAnnotation returnType;
final Identifier name;
- /// The generic type parameters to the function type.
- ///
- /// For example `A` and `B` (but not `T`) are type parameters in
- /// `typedef F<T> = Function<A, B>(A, B, T)`;
final NodeList typeParameters;
final NodeList formals;
final Token typedefKeyword;
final Token endToken;
- Typedef(this.isGeneralizedTypeAlias, this.templateParameters, this.returnType,
- this.name, this.typeParameters, this.formals, this.typedefKeyword,
- this.endToken);
+ Typedef(this.returnType, this.name, this.typeParameters, this.formals,
+ this.typedefKeyword, this.endToken);
Typedef asTypedef() => this;
@@ -2912,7 +2872,6 @@ class Typedef extends Node {
accept1(Visitor1 visitor, arg) => visitor.visitTypedef(this, arg);
visitChildren(Visitor visitor) {
- if (templateParameters != null) templateParameters.accept(visitor);
if (returnType != null) returnType.accept(visitor);
name.accept(visitor);
if (typeParameters != null) typeParameters.accept(visitor);
@@ -2920,7 +2879,6 @@ class Typedef extends Node {
}
visitChildren1(Visitor1 visitor, arg) {
- if (templateParameters != null) templateParameters.accept1(visitor, arg);
if (returnType != null) returnType.accept1(visitor, arg);
name.accept1(visitor, arg);
if (typeParameters != null) typeParameters.accept1(visitor, arg);
@@ -2932,43 +2890,6 @@ class Typedef extends Node {
Token getEndToken() => endToken;
}
-class FunctionTypeAnnotation extends TypeAnnotation {
- final TypeAnnotation returnType;
- final Token functionToken;
- final NodeList typeParameters;
- final NodeList formals;
-
- FunctionTypeAnnotation(
- this.returnType, this.functionToken, this.typeParameters, this.formals);
-
- FunctionTypeAnnotation asFunctionTypeAnnotation() => this;
-
- accept(Visitor visitor) => visitor.visitFunctionTypeAnnotation(this);
-
- accept1(Visitor1 visitor, arg) {
- return visitor.visitFunctionTypeAnnotation(this, arg);
- }
-
- visitChildren(Visitor visitor) {
- if (returnType != null) returnType.accept(visitor);
- if (typeParameters != null) typeParameters.accept(visitor);
- formals.accept(visitor);
- }
-
- visitChildren1(Visitor1 visitor, arg) {
- if (returnType != null) returnType.accept1(visitor, arg);
- if (typeParameters != null) typeParameters.accept1(visitor, arg);
- formals.accept1(visitor, arg);
- }
-
- Token getBeginToken() {
- if (returnType != null) return returnType.getBeginToken();
- return functionToken;
- }
-
- Token getEndToken() => formals.getEndToken();
-}
-
class TryStatement extends Statement {
final Block tryBlock;
final NodeList catchBlocks;
@@ -3213,8 +3134,6 @@ class ErrorNode extends Node
get type => null;
// Typedef.
- get isGeneralizedTypeAlias => null;
- get templateParameters => null;
get typeParameters => null;
get formals => null;
get typedefKeyword => null;
« no previous file with comments | « pkg/compiler/lib/src/tokens/token.dart ('k') | pkg/compiler/lib/src/tree/prettyprint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698