Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| 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.resolver; | 5 package com.google.dart.compiler.resolver; |
| 6 | 6 |
| 7 import com.google.common.annotations.VisibleForTesting; | 7 import com.google.common.annotations.VisibleForTesting; |
| 8 import com.google.dart.compiler.DartCompilationError; | 8 import com.google.dart.compiler.DartCompilationError; |
| 9 import com.google.dart.compiler.DartCompilerContext; | 9 import com.google.dart.compiler.DartCompilerContext; |
| 10 import com.google.dart.compiler.DartCompilerErrorCode; | 10 import com.google.dart.compiler.DartCompilerErrorCode; |
| 11 import com.google.dart.compiler.DartCompilerListener; | 11 import com.google.dart.compiler.DartCompilerListener; |
| 12 import com.google.dart.compiler.ErrorCode; | 12 import com.google.dart.compiler.ErrorCode; |
| 13 import com.google.dart.compiler.ast.DartClass; | 13 import com.google.dart.compiler.ast.DartClass; |
| 14 import com.google.dart.compiler.ast.DartField; | 14 import com.google.dart.compiler.ast.DartField; |
| 15 import com.google.dart.compiler.ast.DartFieldDefinition; | 15 import com.google.dart.compiler.ast.DartFieldDefinition; |
| 16 import com.google.dart.compiler.ast.DartFunctionTypeAlias; | 16 import com.google.dart.compiler.ast.DartFunctionTypeAlias; |
| 17 import com.google.dart.compiler.ast.DartMethodDefinition; | 17 import com.google.dart.compiler.ast.DartMethodDefinition; |
| 18 import com.google.dart.compiler.ast.DartNode; | 18 import com.google.dart.compiler.ast.DartNode; |
| 19 import com.google.dart.compiler.ast.DartNodeTraverser; | 19 import com.google.dart.compiler.ast.DartNodeTraverser; |
| 20 import com.google.dart.compiler.ast.DartTypeParameter; | 20 import com.google.dart.compiler.ast.DartTypeParameter; |
| 21 import com.google.dart.compiler.ast.DartUnit; | 21 import com.google.dart.compiler.ast.DartUnit; |
| 22 import com.google.dart.compiler.ast.LibraryUnit; | 22 import com.google.dart.compiler.ast.LibraryUnit; |
| 23 import com.google.dart.compiler.ast.Modifiers; | |
| 23 import com.google.dart.compiler.common.SourceInfo; | 24 import com.google.dart.compiler.common.SourceInfo; |
| 24 import com.google.dart.compiler.type.Types; | 25 import com.google.dart.compiler.type.Types; |
| 25 | 26 |
| 26 import java.util.List; | 27 import java.util.List; |
| 27 | 28 |
| 28 /** | 29 /** |
| 29 * Builds all class elements and types of a library. Once all libraries | 30 * Builds all class elements and types of a library. Once all libraries |
| 30 * of an application have built their types, the library scope per | 31 * of an application have built their types, the library scope per |
| 31 * library can be computed. | 32 * library can be computed. |
| 32 */ | 33 */ |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 } | 144 } |
| 144 | 145 |
| 145 @Override | 146 @Override |
| 146 public Void visitMethodDefinition(DartMethodDefinition node) { | 147 public Void visitMethodDefinition(DartMethodDefinition node) { |
| 147 node.setSymbol(Elements.methodFromMethodNode(node, library)); | 148 node.setSymbol(Elements.methodFromMethodNode(node, library)); |
| 148 return null; | 149 return null; |
| 149 } | 150 } |
| 150 | 151 |
| 151 @Override | 152 @Override |
| 152 public Void visitField(DartField node) { | 153 public Void visitField(DartField node) { |
| 153 node.setSymbol(Elements.fieldFromNode(node, library, node.getModifiers())) ; | 154 Modifiers modifiers = node.getModifiers(); |
| 155 if (modifiers.isFinal()) { | |
| 156 // final toplevel fields are implicitly compile-time constants. | |
|
ngeoffray
2011/10/17 10:59:38
Again, since they must all be compile-time constan
| |
| 157 modifiers = modifiers.makeConstant(); | |
| 158 } | |
| 159 node.setSymbol(Elements.fieldFromNode(node, library, modifiers)); | |
| 154 return null; | 160 return null; |
| 155 } | 161 } |
| 156 } | 162 } |
| 157 } | 163 } |
| OLD | NEW |