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

Side by Side Diff: pkg/analyzer/tool/summary/mini_ast.dart

Issue 2996163002: support class native clause (Closed)
Patch Set: add new fasta native clause error code Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:front_end/src/fasta/problems.dart' 5 import 'package:front_end/src/fasta/problems.dart'
6 show internalProblem, unsupported; 6 show internalProblem, unsupported;
7 import 'package:front_end/src/fasta/messages.dart' show Message; 7 import 'package:front_end/src/fasta/messages.dart' show Message;
8 import 'package:front_end/src/fasta/parser.dart'; 8 import 'package:front_end/src/fasta/parser.dart';
9 import 'package:front_end/src/fasta/source/stack_listener.dart'; 9 import 'package:front_end/src/fasta/source/stack_listener.dart';
10 import 'package:front_end/src/scanner/token.dart'; 10 import 'package:front_end/src/scanner/token.dart';
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 debugEvent("ClassBody"); 186 debugEvent("ClassBody");
187 push(popList(memberCount)); 187 push(popList(memberCount));
188 } 188 }
189 189
190 void endClassDeclaration( 190 void endClassDeclaration(
191 int interfacesCount, 191 int interfacesCount,
192 Token beginToken, 192 Token beginToken,
193 Token classKeyword, 193 Token classKeyword,
194 Token extendsKeyword, 194 Token extendsKeyword,
195 Token implementsKeyword, 195 Token implementsKeyword,
196 Token nativeToken,
196 Token endToken) { 197 Token endToken) {
197 debugEvent("ClassDeclaration"); 198 debugEvent("ClassDeclaration");
198 List<ClassMember> members = pop(); 199 List<ClassMember> members = pop();
200 if (nativeToken?.next?.type == TokenType.STRING) {
201 pop(); // native clause - StringLiteral
202 }
199 TypeName superclass = pop(); 203 TypeName superclass = pop();
200 pop(); // Type variables 204 pop(); // Type variables
201 String name = pop(); 205 String name = pop();
202 List<Annotation> metadata = pop(); 206 List<Annotation> metadata = pop();
203 Comment comment = pop(); 207 Comment comment = pop();
204 compilationUnit.declarations.add( 208 compilationUnit.declarations.add(
205 new ClassDeclaration(comment, metadata, name, superclass, members)); 209 new ClassDeclaration(comment, metadata, name, superclass, members));
206 } 210 }
207 211
208 @override 212 @override
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 final String name; 480 final String name;
477 481
478 final List<TypeName> typeArguments; 482 final List<TypeName> typeArguments;
479 483
480 TypeName(this.name, this.typeArguments); 484 TypeName(this.name, this.typeArguments);
481 } 485 }
482 486
483 /// "Mini AST" representation of an expression which summary code generation 487 /// "Mini AST" representation of an expression which summary code generation
484 /// need not be concerned about. 488 /// need not be concerned about.
485 class UnknownExpression extends Expression {} 489 class UnknownExpression extends Expression {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698