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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantVisitor.java

Issue 66253002: Version 0.8.10.9 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/error/ErrorReporter.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 30 matching lines...) Expand all
41 import com.google.dart.engine.ast.StringInterpolation; 41 import com.google.dart.engine.ast.StringInterpolation;
42 import com.google.dart.engine.ast.StringLiteral; 42 import com.google.dart.engine.ast.StringLiteral;
43 import com.google.dart.engine.ast.SymbolLiteral; 43 import com.google.dart.engine.ast.SymbolLiteral;
44 import com.google.dart.engine.ast.visitor.UnifyingASTVisitor; 44 import com.google.dart.engine.ast.visitor.UnifyingASTVisitor;
45 import com.google.dart.engine.element.ClassElement; 45 import com.google.dart.engine.element.ClassElement;
46 import com.google.dart.engine.element.CompilationUnitElement; 46 import com.google.dart.engine.element.CompilationUnitElement;
47 import com.google.dart.engine.element.ConstructorElement; 47 import com.google.dart.engine.element.ConstructorElement;
48 import com.google.dart.engine.element.Element; 48 import com.google.dart.engine.element.Element;
49 import com.google.dart.engine.element.ExecutableElement; 49 import com.google.dart.engine.element.ExecutableElement;
50 import com.google.dart.engine.element.FunctionElement; 50 import com.google.dart.engine.element.FunctionElement;
51 import com.google.dart.engine.element.FunctionTypeAliasElement;
51 import com.google.dart.engine.element.LibraryElement; 52 import com.google.dart.engine.element.LibraryElement;
52 import com.google.dart.engine.element.PrefixElement; 53 import com.google.dart.engine.element.PrefixElement;
53 import com.google.dart.engine.element.PropertyAccessorElement; 54 import com.google.dart.engine.element.PropertyAccessorElement;
54 import com.google.dart.engine.error.CompileTimeErrorCode; 55 import com.google.dart.engine.error.CompileTimeErrorCode;
55 import com.google.dart.engine.error.ErrorCode; 56 import com.google.dart.engine.error.ErrorCode;
56 import com.google.dart.engine.internal.element.VariableElementImpl; 57 import com.google.dart.engine.internal.element.VariableElementImpl;
57 import com.google.dart.engine.scanner.TokenType; 58 import com.google.dart.engine.scanner.TokenType;
58 59
59 /** 60 /**
60 * Instances of the class {@code ConstantVisitor} evaluate constant expressions to produce their 61 * Instances of the class {@code ConstantVisitor} evaluate constant expressions to produce their
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (element instanceof VariableElementImpl) { 395 if (element instanceof VariableElementImpl) {
395 VariableElementImpl variableElementImpl = (VariableElementImpl) element; 396 VariableElementImpl variableElementImpl = (VariableElementImpl) element;
396 EvaluationResultImpl value = variableElementImpl.getEvaluationResult(); 397 EvaluationResultImpl value = variableElementImpl.getEvaluationResult();
397 if (variableElementImpl.isConst() && value != null) { 398 if (variableElementImpl.isConst() && value != null) {
398 return value; 399 return value;
399 } 400 }
400 } else if (element instanceof ExecutableElement) { 401 } else if (element instanceof ExecutableElement) {
401 if (((ExecutableElement) element).isStatic()) { 402 if (((ExecutableElement) element).isStatic()) {
402 return new ValidResult(element); 403 return new ValidResult(element);
403 } 404 }
404 } else if (element instanceof ClassElement) { 405 } else if (element instanceof ClassElement || element instanceof FunctionTyp eAliasElement) {
405 return ValidResult.RESULT_OBJECT; 406 return ValidResult.RESULT_OBJECT;
406 } 407 }
407 // TODO(brianwilkerson) Figure out which error to report. 408 // TODO(brianwilkerson) Figure out which error to report.
408 return error(node, null); 409 return error(node, null);
409 } 410 }
410 411
411 /** 412 /**
412 * Return the union of the errors encoded in the given results. 413 * Return the union of the errors encoded in the given results.
413 * 414 *
414 * @param leftResult the first set of errors, or {@code null} if there was no previous collection 415 * @param leftResult the first set of errors, or {@code null} if there was no previous collection
415 * of errors 416 * of errors
416 * @param rightResult the errors to be added to the collection, or a valid res ult if there are no 417 * @param rightResult the errors to be added to the collection, or a valid res ult if there are no
417 * errors to be added 418 * errors to be added
418 * @return the union of the errors encoded in the given results 419 * @return the union of the errors encoded in the given results
419 */ 420 */
420 private ErrorResult union(ErrorResult leftResult, EvaluationResultImpl rightRe sult) { 421 private ErrorResult union(ErrorResult leftResult, EvaluationResultImpl rightRe sult) {
421 if (rightResult instanceof ErrorResult) { 422 if (rightResult instanceof ErrorResult) {
422 if (leftResult != null) { 423 if (leftResult != null) {
423 return new ErrorResult(leftResult, (ErrorResult) rightResult); 424 return new ErrorResult(leftResult, (ErrorResult) rightResult);
424 } else { 425 } else {
425 return (ErrorResult) rightResult; 426 return (ErrorResult) rightResult;
426 } 427 }
427 } 428 }
428 return leftResult; 429 return leftResult;
429 } 430 }
430 } 431 }
OLDNEW
« no previous file with comments | « no previous file | dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/error/ErrorReporter.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698