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

Side by Side Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTestCase.java

Issue 10661022: Issue 3752. Support for @override annotations (as structured doc comments) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
Brian Wilkerson 2012/06/25 14:24:38 nit: copyright year
scheglov 2012/06/26 19:46:34 Done.
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 package com.google.dart.compiler.type; 5 package com.google.dart.compiler.type;
6 6
7 import com.google.common.base.Joiner; 7 import com.google.common.base.Joiner;
8 import com.google.common.collect.Maps; 8 import com.google.common.collect.Maps;
9 import com.google.common.collect.Sets;
9 import com.google.common.io.CharStreams; 10 import com.google.common.io.CharStreams;
10 import com.google.dart.compiler.ErrorCode; 11 import com.google.dart.compiler.ErrorCode;
11 import com.google.dart.compiler.ast.DartClass; 12 import com.google.dart.compiler.ast.DartClass;
12 import com.google.dart.compiler.ast.DartExprStmt; 13 import com.google.dart.compiler.ast.DartExprStmt;
13 import com.google.dart.compiler.ast.DartExpression; 14 import com.google.dart.compiler.ast.DartExpression;
14 import com.google.dart.compiler.ast.DartField; 15 import com.google.dart.compiler.ast.DartField;
15 import com.google.dart.compiler.ast.DartFieldDefinition; 16 import com.google.dart.compiler.ast.DartFieldDefinition;
16 import com.google.dart.compiler.ast.DartFunctionExpression; 17 import com.google.dart.compiler.ast.DartFunctionExpression;
17 import com.google.dart.compiler.ast.DartFunctionTypeAlias; 18 import com.google.dart.compiler.ast.DartFunctionTypeAlias;
18 import com.google.dart.compiler.ast.DartNode; 19 import com.google.dart.compiler.ast.DartNode;
19 import com.google.dart.compiler.ast.DartStatement; 20 import com.google.dart.compiler.ast.DartStatement;
20 import com.google.dart.compiler.ast.DartUnit; 21 import com.google.dart.compiler.ast.DartUnit;
21 import com.google.dart.compiler.ast.LibraryUnit; 22 import com.google.dart.compiler.ast.LibraryUnit;
22 import com.google.dart.compiler.parser.DartParser; 23 import com.google.dart.compiler.parser.DartParser;
23 import com.google.dart.compiler.parser.DartScannerParserContext;
24 import com.google.dart.compiler.resolver.ClassElement; 24 import com.google.dart.compiler.resolver.ClassElement;
25 import com.google.dart.compiler.resolver.ClassNodeElement; 25 import com.google.dart.compiler.resolver.ClassNodeElement;
26 import com.google.dart.compiler.resolver.CoreTypeProvider; 26 import com.google.dart.compiler.resolver.CoreTypeProvider;
27 import com.google.dart.compiler.resolver.Element; 27 import com.google.dart.compiler.resolver.Element;
28 import com.google.dart.compiler.resolver.Elements; 28 import com.google.dart.compiler.resolver.Elements;
29 import com.google.dart.compiler.resolver.FunctionAliasElement; 29 import com.google.dart.compiler.resolver.FunctionAliasElement;
30 import com.google.dart.compiler.resolver.LibraryElement; 30 import com.google.dart.compiler.resolver.LibraryElement;
31 import com.google.dart.compiler.resolver.MemberBuilder; 31 import com.google.dart.compiler.resolver.MemberBuilder;
32 import com.google.dart.compiler.resolver.MockLibraryUnit; 32 import com.google.dart.compiler.resolver.MockLibraryUnit;
33 import com.google.dart.compiler.resolver.ResolutionContext; 33 import com.google.dart.compiler.resolver.ResolutionContext;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 assertEquals(type, typeOf("x = " + expression)); 258 assertEquals(type, typeOf("x = " + expression));
259 } 259 }
260 260
261 private Scope getMockScope(String name) { 261 private Scope getMockScope(String name) {
262 LibraryUnit libraryUnit = MockLibraryUnit.create(); 262 LibraryUnit libraryUnit = MockLibraryUnit.create();
263 return new Scope(name, libraryUnit.getElement(), new MockScope()); 263 return new Scope(name, libraryUnit.getElement(), new MockScope());
264 } 264 }
265 265
266 private DartParser getParser(String string) { 266 private DartParser getParser(String string) {
267 DartSourceString source = new DartSourceString("<source string>", string); 267 DartSourceString source = new DartSourceString("<source string>", string);
268 return new DartParser(new DartScannerParserContext(source, string, listener) ); 268 return new DartParser(source, string, false, Sets.<String>newHashSet(), list ener, null);
269 } 269 }
270 270
271 private String getResource(String name) { 271 private String getResource(String name) {
272 String packageName = getClass().getPackage().getName().replace('.', '/'); 272 String packageName = getClass().getPackage().getName().replace('.', '/');
273 String resouceName = packageName + "/" + name; 273 String resouceName = packageName + "/" + name;
274 InputStream stream = getClass().getClassLoader().getResourceAsStream(resouce Name); 274 InputStream stream = getClass().getClassLoader().getResourceAsStream(resouce Name);
275 if (stream == null) { 275 if (stream == null) {
276 throw new AssertionError("Missing resource: " + resouceName); 276 throw new AssertionError("Missing resource: " + resouceName);
277 } 277 }
278 InputStreamReader reader = new InputStreamReader(stream); 278 InputStreamReader reader = new InputStreamReader(stream);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 private DartExpression parseExpression(String source) { 350 private DartExpression parseExpression(String source) {
351 return getParser(source).parseExpression(); 351 return getParser(source).parseExpression();
352 } 352 }
353 353
354 private DartStatement parseStatement(String source) { 354 private DartStatement parseStatement(String source) {
355 return getParser(source).parseStatement(); 355 return getParser(source).parseStatement();
356 } 356 }
357 357
358 private DartUnit parseUnit(String string) { 358 private DartUnit parseUnit(String string) {
359 DartSourceString source = new DartSourceString("<source string>", string); 359 DartSourceString source = new DartSourceString("<source string>", string);
360 return getParser(string).parseUnit(source); 360 return getParser(string).parseUnit();
361 } 361 }
362 362
363 protected String returnWithType(String type, Object expression) { 363 protected String returnWithType(String type, Object expression) {
364 return String.format("%s foo() { return %s; }", type, String.valueOf(express ion)); 364 return String.format("%s foo() { return %s; }", type, String.valueOf(express ion));
365 } 365 }
366 366
367 @Override 367 @Override
368 protected void tearDown() { 368 protected void tearDown() {
369 resolver = null; 369 resolver = null;
370 diagnosedAbstractClasses = null; 370 diagnosedAbstractClasses = null;
371 } 371 }
372 372
373 private Type typeOf(String expression) { 373 private Type typeOf(String expression) {
374 return analyzeNode(parseExpression(expression)); 374 return analyzeNode(parseExpression(expression));
375 } 375 }
376 } 376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698