Changeset 3122
- Timestamp:
- 11/29/08 22:56:33 (12 months ago)
- Location:
- trunk/ProjectFortress
- Files:
-
- 52 modified
-
astgen/Fortress.ast (modified) (17 diffs)
-
src/com/sun/fortress/compiler/Disambiguator.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/IndexBuilder.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java (modified) (5 diffs)
-
src/com/sun/fortress/compiler/desugarer/DottedMethodRewriteVisitor.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/desugarer/MutableVarRefRewriteVisitor.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/disambiguator/TopLevelEnv.java (modified) (3 diffs)
-
src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java (modified) (6 diffs)
-
src/com/sun/fortress/compiler/environments/TopLevelEnvGen.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/index/CompilationUnitIndex.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/index/FieldGetterMethod.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/index/FieldSetterMethod.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/index/TypeAliasIndex.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/FnTypeEnv.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/MethodTypeEnv.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/typechecker/ObjectTypeEnv.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/TypeChecker.java (modified) (18 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypeEnv.java (modified) (4 diffs)
-
src/com/sun/fortress/interpreter/Driver.java (modified) (4 diffs)
-
src/com/sun/fortress/interpreter/evaluator/BuildEnvironments.java (modified) (4 diffs)
-
src/com/sun/fortress/interpreter/evaluator/BuildLetEnvironments.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/evaluator/BuildTopLevelEnvironments.java (modified) (3 diffs)
-
src/com/sun/fortress/interpreter/evaluator/EvalType.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/evaluator/EvaluatorBase.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/evaluator/LHSEvaluator.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/evaluator/values/FGenericFunction.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/evaluator/values/SingleFcn.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/glue/NativeApp.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/rewrite/DesugarerVisitor.java (modified) (2 diffs)
-
src/com/sun/fortress/interpreter/rewrite/IsAnArrowName.java (modified) (2 diffs)
-
src/com/sun/fortress/nodes_util/ApiMaker.java (modified) (5 diffs)
-
src/com/sun/fortress/nodes_util/ErrorMsgMaker.java (modified) (2 diffs)
-
src/com/sun/fortress/nodes_util/ExprFactory.java (modified) (1 diff)
-
src/com/sun/fortress/nodes_util/NodeComparator.java (modified) (1 diff)
-
src/com/sun/fortress/nodes_util/NodeFactory.java (modified) (4 diffs)
-
src/com/sun/fortress/nodes_util/NodeUtil.java (modified) (6 diffs)
-
src/com/sun/fortress/parser/TraitObject.rats (modified) (1 diff)
-
src/com/sun/fortress/parser_util/FortressUtil.java (modified) (1 diff)
-
src/com/sun/fortress/parser_util/SyntaxChecker.java (modified) (2 diffs)
-
src/com/sun/fortress/syntax_abstractions/GrammarComposer.java (modified) (2 diffs)
-
src/com/sun/fortress/syntax_abstractions/environments/EnvFactory.java (modified) (1 diff)
-
src/com/sun/fortress/syntax_abstractions/parser/PreParser.java (modified) (2 diffs)
-
src/com/sun/fortress/syntax_abstractions/phases/ComposingSyntaxDefTranslator.java (modified) (9 diffs)
-
src/com/sun/fortress/syntax_abstractions/phases/EscapeRewriter.java (modified) (1 diff)
-
src/com/sun/fortress/syntax_abstractions/phases/ExtensionDesugarer.java (modified) (3 diffs)
-
src/com/sun/fortress/syntax_abstractions/phases/GrammarRewriter.java (modified) (1 diff)
-
src/com/sun/fortress/syntax_abstractions/phases/TemplateParser.java (modified) (1 diff)
-
src/com/sun/fortress/syntax_abstractions/phases/Transform.java (modified) (1 diff)
-
src/com/sun/fortress/tools/FortressAstToConcrete.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/astgen/Fortress.ast
r3120 r3122 144 144 * | QualifiedName (as Id)? 145 145 */ 146 abstract ImportedNames(APIName api );146 abstract ImportedNames(APIName apiName); 147 147 /** 148 148 * Names must be unqualified. 149 149 * e.g.) import Set.{...} except {opr UNION, union} 150 150 */ 151 ImportStar(List<IdOrOpOrAnonymousName> except );151 ImportStar(List<IdOrOpOrAnonymousName> exceptNames); 152 152 /** 153 153 * e.g.) import Set.{empty, union} … … 175 175 * Alias must be unqualified. 176 176 */ 177 AliasedAPIName(APIName api ,177 AliasedAPIName(APIName apiName, 178 178 Option<Id> alias = Option.<Id>none()); 179 179 /** … … 192 192 List<TraitTypeWhere> extendsClause 193 193 = Collections.<TraitTypeWhere>emptyList(), 194 Option<WhereClause> where 194 Option<WhereClause> whereClause 195 195 = Option.<WhereClause>none(), 196 196 List<Decl> decls) … … 239 239 * end 240 240 */ 241 TraitDecl(List<BaseType> excludes = Collections.<BaseType>emptyList(),242 Option<List<BaseType>> comprises 241 TraitDecl(List<BaseType> excludesClause = Collections.<BaseType>emptyList(), 242 Option<List<BaseType>> comprisesClause 243 243 = Option.<List<BaseType>>none()) implements Generic; 244 244 /** … … 340 340 Option<Type> returnType = Option.<Type>none(), 341 341 Option<List<BaseType>> throwsClause = Option.<List<BaseType>>none(), 342 Option<WhereClause> where = Option.<WhereClause>none(),342 Option<WhereClause> whereClause = Option.<WhereClause>none(), 343 343 Option<Contract> contract = Option.<Contract>none(), 344 344 Id unambiguousName = new Id(in_span, "FN$"+in_span.toString()), … … 374 374 * e.g.) dim Length SI_unit meter meters m 375 375 */ 376 DimDecl(Id dim , Option<Type> derived = Option.<Type>none(),377 Option<Id> default = Option.<Id>none());376 DimDecl(Id dimId, Option<Type> derived = Option.<Type>none(), 377 Option<Id> defaultId = Option.<Id>none()); 378 378 /** 379 379 * unit declaration … … 383 383 UnitDecl(boolean si_unit = false, 384 384 List<Id> units = Collections.<Id>emptyList(), 385 Option<Type> dim = Option.<Type>none(),386 Option<Expr> def );385 Option<Type> dimType = Option.<Type>none(), 386 Option<Expr> defExpr); 387 387 /** 388 388 * test declaration … … 408 408 List<StaticParam> staticParams 409 409 = Collections.<StaticParam>emptyList(), 410 Type type );410 Type typeDef); 411 411 /** 412 412 * grammar declaration 413 413 * Names (but not extends elements) must be unqualified. 414 414 */ 415 abstract GrammarDecl(Id name, List<Id> extends );415 abstract GrammarDecl(Id name, List<Id> extendsClause); 416 416 /** 417 417 * grammar definition 418 418 */ 419 419 GrammarDef(List<GrammarMemberDecl> members, List<TransformerDecl> transformers, 420 boolean native);420 boolean nativeDef); 421 421 /** 422 422 * grammar member (nonterminal or terminal) declaration … … 445 445 List<StaticParam> staticParams 446 446 = Collections.<StaticParam>emptyList(), 447 Option<Type> type,447 Option<Type> paramType, 448 448 Option<WhereClause> whereClause 449 449 = Option.<WhereClause>none()); … … 452 452 * nonterminal parameter 453 453 */ 454 NonterminalParameter(Id name, BaseType type);454 NonterminalParameter(Id name, BaseType paramType); 455 455 456 456 /** … … 464 464 TransformerDecl transformer); 465 465 466 SuperSyntaxDef(Id nonterminal, Id grammar );466 SuperSyntaxDef(Id nonterminal, Id grammarId); 467 467 468 468 /** … … 605 605 * character interval 606 606 */ 607 CharacterInterval(String begin , String end);607 CharacterInterval(String beginSymbol, String endSymbol); 608 608 /** 609 609 * left-hand side of variable declaration or value parameter … … 611 611 abstract Binding(Id name, 612 612 List<Modifier> mods = Collections.<Modifier>emptyList(), 613 Option<Type> type = Option.<Type>none()) implements Lhs;613 Option<Type> idType = Option.<Type>none()) implements Lhs; 614 614 /** 615 615 * left-hand side of variable declaration … … 896 896 Option<Type> returnType 897 897 = Option.<Type>none(), 898 Option<WhereClause> where 898 Option<WhereClause> whereClause 899 899 = Option.<WhereClause>none(), 900 900 Option<List<BaseType>> throwsClause … … 1370 1370 _RewriteGenericArrowType(List<StaticParam> staticParams 1371 1371 = Collections.<StaticParam>emptyList(), 1372 Option<WhereClause> where 1372 Option<WhereClause> whereClause 1373 1373 = Option.<WhereClause>none()); 1374 1374 /** … … 2019 2019 */ 2020 2020 TraitTypeWhere(BaseType type, 2021 Option<WhereClause> where 2021 Option<WhereClause> whereClause 2022 2022 = Option.<WhereClause>none()); 2023 2023 /** … … 2139 2139 List<Param> params, 2140 2140 Option<Type> returnType, 2141 Option<WhereClause> where );2141 Option<WhereClause> whereClause); 2142 2142 2143 2143 end; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/Disambiguator.java
r2729 r3122 217 217 GrammarDef og = e.getValue().ast(); 218 218 List<GrammarIndex> ls = new LinkedList<GrammarIndex>(); 219 for (Id n: og.getExtends ()) {219 for (Id n: og.getExtendsClause()) { 220 220 GrammarIndex g = grammars.get(n.getText()); 221 221 if ( g == null ){ -
trunk/ProjectFortress/src/com/sun/fortress/compiler/IndexBuilder.java
r3107 r3122 343 343 ast.getParams(), 344 344 ast.getThrowsClause(), 345 ast.getWhere ());345 ast.getWhereClause()); 346 346 constructor = Option.some(c); 347 347 functions.add(name, c); … … 436 436 private void buildDimension(DimDecl ast, 437 437 Map<Id, Dimension> dimensions) { 438 dimensions.put(ast.getDim (), new Dimension(ast));438 dimensions.put(ast.getDimId(), new Dimension(ast)); 439 439 } 440 440 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java
r3115 r3122 245 245 obj = ExprFactory.makeVarRef(obj, obj.getExprType(), 246 246 mangleName(obj.getVar())); 247 body = (Expr)forFieldRefOnly(rewrite, field.get Type(),247 body = (Expr)forFieldRefOnly(rewrite, field.getIdType(), 248 248 obj, rewrite.getField()); 249 249 } else { … … 255 255 if ( inTrait ) 256 256 return NodeFactory.makeFnDecl(span, mods, field.getName(), 257 field.get Type(), Option.<Expr>none());257 field.getIdType(), Option.<Expr>none()); 258 258 else 259 259 return NodeFactory.makeFnDecl(span, mods, field.getName(), 260 field.get Type(), body);260 field.getIdType(), body); 261 261 } 262 262 … … 264 264 Span span = field.getSpan(); 265 265 Type voidType = NodeFactory.makeVoidType(span); 266 Option<Type> ty = field.get Type();266 Option<Type> ty = field.getIdType(); 267 267 List<Modifier> mods = new LinkedList<Modifier>(); 268 268 for (Modifier mod : field.getMods()) { … … 581 581 return forObjectDeclOnly(that, that.getMods(), that.getName(), 582 582 that.getStaticParams(), that.getExtendsClause(), 583 that.getWhere (), gettersAndDecls, params_result,583 that.getWhereClause(), gettersAndDecls, params_result, 584 584 that.getThrowsClause(), contract_result); 585 585 } … … 603 603 return forTraitDeclOnly(that, that.getMods(), that.getName(), 604 604 that.getStaticParams(), that.getExtendsClause(), 605 that.getWhere (), gettersAndDecls,606 that.getExcludes (), that.getComprises());605 that.getWhereClause(), gettersAndDecls, 606 that.getExcludesClause(), that.getComprisesClause()); 607 607 } 608 608 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/DottedMethodRewriteVisitor.java
r3098 r3122 51 51 return super.forObjectDeclOnly(that, that.getMods(), that.getName(), 52 52 that.getStaticParams(), 53 that.getExtendsClause(), that.getWhere (),53 that.getExtendsClause(), that.getWhereClause(), 54 54 decls_result, that.getParams(), 55 55 that.getThrowsClause(), that.getContract()); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java
r3102 r3122 1014 1014 @Override 1015 1015 public void forDimDecl(DimDecl that) { 1016 decledNames.add(that.getDim ());1016 decledNames.add(that.getDimId()); 1017 1017 } 1018 1018 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/MutableVarRefRewriteVisitor.java
r3102 r3122 94 94 return super.forObjectDeclOnly(that, that.getMods(), that.getName(), 95 95 that.getStaticParams(), 96 that.getExtendsClause(), that.getWhere (),96 that.getExtendsClause(), that.getWhereClause(), 97 97 decls_result, that.getParams(), 98 98 that.getThrowsClause(), that.getContract()); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java
r3112 r3122 881 881 VarRef varRef = ExprFactory.makeVarRef( param.getSpan(), 882 882 param.getName(), 883 param.get Type() );883 param.getIdType() ); 884 884 return varRef; 885 885 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java
r3098 r3122 670 670 v.recurOnListOfStaticParam(that.getStaticParams()), 671 671 extendsClause, 672 v.recurOnOptionOfWhereClause(that.getWhere ()),672 v.recurOnOptionOfWhereClause(that.getWhereClause()), 673 673 v.recurOnListOfDecl(that.getDecls()), 674 v.recurOnListOfBaseType(that.getExcludes ()),675 v.recurOnOptionOfListOfBaseType(that.getComprises ()));674 v.recurOnListOfBaseType(that.getExcludesClause()), 675 v.recurOnOptionOfListOfBaseType(that.getComprisesClause())); 676 676 } 677 677 … … 718 718 v.recurOnListOfStaticParam(that.getStaticParams()), 719 719 extendsClause, 720 v.recurOnOptionOfWhereClause(that.getWhere ()),720 v.recurOnOptionOfWhereClause(that.getWhereClause()), 721 721 v.recurOnListOfDecl(that.getDecls()), 722 722 v.recurOnOptionOfListOfParam(that.getParams()), … … 749 749 v.recurOnOptionOfType(that.getReturnType()), 750 750 v.recurOnOptionOfListOfBaseType(that.getThrowsClause()), 751 v.recurOnOptionOfWhereClause(that.getWhere ()),751 v.recurOnOptionOfWhereClause(that.getWhereClause()), 752 752 v.recurOnOptionOfContract(that.getContract()), 753 753 that.getUnambiguousName(), … … 803 803 v.recurOnListOfParam(that.getParams()), 804 804 v.recurOnOptionOfType(that.getReturnType()), 805 v.recurOnOptionOfWhereClause(that.getWhere ()),805 v.recurOnOptionOfWhereClause(that.getWhereClause()), 806 806 v.recurOnOptionOfListOfBaseType(that.getThrowsClause()), 807 807 (Expr) that.getBody().accept(v)); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TopLevelEnv.java
r3118 r3122 707 707 Boolean implib = true; 708 708 for( AliasedAPIName api : that.getApis() ) { 709 APIName name = api.getApi ();709 APIName name = api.getApiName(); 710 710 if(name.getText().equals(WellKnownNames.fortressLibrary)) 711 711 implib=false; … … 718 718 @Override 719 719 public Boolean forImportNames(ImportNames that) { 720 APIName name = that.getApi ();720 APIName name = that.getApiName(); 721 721 722 722 // TODO Handle these aliased names more thoroughly … … 737 737 @Override 738 738 public Boolean forImportStar(ImportStar that) { 739 APIName name = that.getApi ();739 APIName name = that.getApiName(); 740 740 if( exceptions.containsKey(name) ) 741 exceptions.get(name).addAll(that.getExcept ());741 exceptions.get(name).addAll(that.getExceptNames()); 742 742 else 743 exceptions.put(name, new HashSet<IdOrOpOrAnonymousName>(that.getExcept ()));743 exceptions.put(name, new HashSet<IdOrOpOrAnonymousName>(that.getExceptNames())); 744 744 return !name.getText().equals(WellKnownNames.fortressLibrary); 745 745 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java
r3114 r3122 142 142 v.recurOnListOfStaticParam(that.getStaticParams()), 143 143 v.recurOnListOfTraitTypeWhere(that.getExtendsClause()), 144 v.recurOnOptionOfWhereClause(that.getWhere ()),144 v.recurOnOptionOfWhereClause(that.getWhereClause()), 145 145 v.recurOnListOfDecl(that.getDecls()), 146 v.recurOnListOfBaseType(that.getExcludes ()),147 v.recurOnOptionOfListOfBaseType(that.getComprises ()));146 v.recurOnListOfBaseType(that.getExcludesClause()), 147 v.recurOnOptionOfListOfBaseType(that.getComprisesClause())); 148 148 } 149 149 … … 160 160 v.recurOnListOfStaticParam(that.getStaticParams()), 161 161 v.recurOnListOfTraitTypeWhere(that.getExtendsClause()), 162 v.recurOnOptionOfWhereClause(that.getWhere ()),162 v.recurOnOptionOfWhereClause(that.getWhereClause()), 163 163 v.recurOnListOfDecl(that.getDecls()), 164 164 v.recurOnOptionOfListOfParam(that.getParams()), … … 181 181 v.recurOnOptionOfType(that.getReturnType()), 182 182 v.recurOnOptionOfListOfBaseType(that.getThrowsClause()), 183 v.recurOnOptionOfWhereClause(that.getWhere ()),183 v.recurOnOptionOfWhereClause(that.getWhereClause()), 184 184 v.recurOnOptionOfContract(that.getContract()), 185 185 that.getUnambiguousName(), … … 441 441 List<Id> ls = new LinkedList<Id>(); 442 442 Collection<GrammarIndex> gs = new LinkedList<GrammarIndex>(); 443 for (Id name: that.getExtends ()) {443 for (Id name: that.getExtendsClause()) { 444 444 Id nname = handleGrammarName(name); 445 445 ls.add(nname); … … 470 470 Id name = handleGrammarName(name_result); 471 471 472 GrammarDef disambiguatedGrammar = new GrammarDef(that.getSpan(), name, p.first(), members_result, transformers, that.isNative ());472 GrammarDef disambiguatedGrammar = new GrammarDef(that.getSpan(), name, p.first(), members_result, transformers, that.isNativeDef()); 473 473 474 474 List<StaticError> newErrs = new ArrayList<StaticError>(); … … 536 536 TypeDisambiguator v = this.extend(that.getStaticParams()); 537 537 538 // System.err.println("T: "+that.get Type());539 540 Option<Type> t = v.recurOnOptionOfType(that.get Type());538 // System.err.println("T: "+that.getParamType()); 539 540 Option<Type> t = v.recurOnOptionOfType(that.getParamType()); 541 541 // System.err.println("t: "+t); 542 542 return forNonterminalHeaderOnly(that, -
trunk/ProjectFortress/src/com/sun/fortress/compiler/environments/TopLevelEnvGen.java
r3082 r3122 232 232 ImportApi importApi = (ImportApi) imports; 233 233 for (AliasedAPIName api : importApi.getApis()) { 234 importedApiNames.add(NodeUtil.nameString(api.getApi ()));234 importedApiNames.add(NodeUtil.nameString(api.getApiName())); 235 235 } 236 236 } else if (imports instanceof ImportedNames) { 237 237 ImportedNames importNames = (ImportedNames) imports; 238 importedApiNames.add(NodeUtil.nameString(importNames.getApi ()));238 importedApiNames.add(NodeUtil.nameString(importNames.getApiName())); 239 239 } else { 240 240 throw StaticError.make("Unrecognized import type in bytecode generation", imports); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/index/CompilationUnitIndex.java
r2699 r3122 71 71 _import.accept(new NodeAbstractVisitor_void() { 72 72 public void forImportedNames(ImportedNames that) { 73 result.add(that.getApi ());73 result.add(that.getApiName()); 74 74 } 75 75 }); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/index/FieldGetterMethod.java
r3115 r3122 74 74 @Override 75 75 public Type getReturnType() { 76 return _ast.get Type().unwrap();76 return _ast.getIdType().unwrap(); 77 77 } 78 78 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/index/FieldSetterMethod.java
r3115 r3122 61 61 new Id(_ast.getSpan(), "fakeParamForImplicitSetter"), 62 62 Collections.<Modifier>emptyList(), 63 _ast.get Type(),63 _ast.getIdType(), 64 64 Option.<Expr>none()); 65 65 return Collections.singletonList(p); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/index/TypeAliasIndex.java
r2455 r3122 38 38 public List<StaticParam> staticParameters() { return _ast.getStaticParams(); } 39 39 40 public Type type() { return _ast.getType (); }40 public Type type() { return _ast.getTypeDef(); } 41 41 42 42 @Override -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/FnTypeEnv.java
r3107 r3122 86 86 if( param.getName().equals(IndexBuilder.SELF_NAME) ) { 87 87 if( param.getVarargsType().isNone() ) 88 self_type_ = param.get Type();88 self_type_ = param.getIdType(); 89 89 else 90 90 InterpreterBug.bug("self cannot be a varargs."); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/MethodTypeEnv.java
r3115 r3122 71 71 Types.VOID, 72 72 // all types have been filled in at this point 73 binding.get Type().unwrap()));73 binding.getIdType().unwrap())); 74 74 75 75 } else { // method instanceof FieldSetterMethod … … 78 78 79 79 overloads.add(makeArrowType(binding.getSpan(), 80 binding.get Type().unwrap(),80 binding.getIdType().unwrap(), 81 81 // all types have been filled in at this point 82 82 Types.VOID)); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/ObjectTypeEnv.java
r3099 r3122 94 94 NodeFactory.makeTraitType(_var, TypeEnv.staticParamsToArgs(decl.getStaticParams())), 95 95 decl.getStaticParams(), 96 decl.getWhere ());96 decl.getWhereClause()); 97 97 } 98 98 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java
r3112 r3122 132 132 } 133 133 static private Type getTypeOfLValue(LValue lval) { 134 return lval.get Type().unwrap();134 return lval.getIdType().unwrap(); 135 135 } 136 136 private static boolean isExprMI(MathItem item) { … … 152 152 153 153 for (LValue binding: bindings) { 154 if (binding.get Type().isSome()) {155 results.add(binding.get Type().unwrap());154 if (binding.getIdType().isSome()) { 155 results.add(binding.getIdType().unwrap()); 156 156 } else 157 157 bug(binding, "Missing type."); … … 249 249 if( arg1.getVarargsType().isNone() ) { 250 250 typeCount++; 251 arg0.add(arg1.get Type().unwrap());251 arg0.add(arg1.getIdType().unwrap()); 252 252 return arg0; 253 253 } … … 619 619 public Type forParam(Param that) { 620 620 if ( that.getVarargsType().isNone() ) 621 return that.get Type().unwrap();621 return that.getIdType().unwrap(); 622 622 else 623 623 return that.getVarargsType().unwrap(); … … 630 630 DeclaredVariable var = (DeclaredVariable)field; 631 631 LValue bind = var.ast(); 632 return Option.some(bind.get Type().unwrap());632 return Option.some(bind.getIdType().unwrap()); 633 633 } 634 634 else { … … 1405 1405 } 1406 1406 else { 1407 Type lhs_type = that.get Type().unwrap();1407 Type lhs_type = that.getIdType().unwrap(); 1408 1408 return Pair.make(checkSubtype(rhs_type, 1409 1409 lhs_type, that, … … 1421 1421 } 1422 1422 else { 1423 Type lhs_type = that.get Type().unwrap();1423 Type lhs_type = that.getIdType().unwrap(); 1424 1424 return Pair.make(checkSubtype(rhs_type, 1425 1425 lhs_type, that, … … 2281 2281 return super.forFnDecl(that); 2282 2282 2283 TypeChecker newChecker = this.extend(that.getStaticParams(), that.getParams(), that.getWhere ());2283 TypeChecker newChecker = this.extend(that.getStaticParams(), that.getParams(), that.getWhereClause()); 2284 2284 2285 2285 TypeCheckerResult result = new TypeCheckerResult(that); … … 2322 2322 returnType, 2323 2323 that.getThrowsClause(), 2324 that.getWhere (),2324 that.getWhereClause(), 2325 2325 contract, 2326 2326 Option.<Expr>some((Expr)bodyResult.ast())); … … 2358 2358 for(Param p: that.getParams()){ 2359 2359 if(p.getVarargsType().isNone()){ 2360 if(p.get Type().isSome()){2361 dlist.add(p.get Type().unwrap());2360 if(p.getIdType().isSome()){ 2361 dlist.add(p.getIdType().unwrap()); 2362 2362 } 2363 2363 else{ … … 2419 2419 that.getParams(), 2420 2420 (Option<Type>)TypeCheckerResult.astFromResult(returnType_result), 2421 that.getWhere (),2421 that.getWhereClause(), 2422 2422 (Option<List<BaseType>>)TypeCheckerResult.astFromResults(throwsClause_result), 2423 2423 (Expr)body_result.ast() ); … … 3345 3345 @Override 3346 3346 public TypeCheckerResult forObjectDecl(final ObjectDecl that) { 3347 TypeChecker checker_with_sparams = this.extend(that.getStaticParams(), that.getParams(), that.getWhere ());3347 TypeChecker checker_with_sparams = this.extend(that.getStaticParams(), that.getParams(), that.getWhereClause()); 3348 3348 List<TypeCheckerResult> modsResult = checker_with_sparams.recurOnListOfModifier(that.getMods()); 3349 3349 TypeCheckerResult nameResult = that.getName().accept(checker_with_sparams); … … 3351 3351 TypeCheckerResult whereResult; 3352 3352 Option<WhereClause> where; 3353 if ( that.getWhere ().isSome() ) {3354 whereResult = that.getWhere ().unwrap().accept(checker_with_sparams);3353 if ( that.getWhereClause().isSome() ) { 3354 whereResult = that.getWhereClause().unwrap().accept(checker_with_sparams); 3355 3355 where = Option.some((WhereClause)whereResult.ast()); 3356 3356 } else { … … 3918 3918 @Override 3919 3919 public TypeCheckerResult forTraitDecl(final TraitDecl that) { 3920 TypeChecker checker_with_sparams = this.extend(that.getStaticParams(), that.getWhere ());3920 TypeChecker checker_with_sparams = this.extend(that.getStaticParams(), that.getWhereClause()); 3921 3921 3922 3922 List<TypeCheckerResult> modsResult = checker_with_sparams.recurOnListOfModifier(that.getMods()); … … 3924 3924 TypeCheckerResult whereResult; 3925 3925 Option<WhereClause> where; 3926 if ( that.getWhere ().isSome() ) {3927 whereResult = that.getWhere ().unwrap().accept(checker_with_sparams);3926 if ( that.getWhereClause().isSome() ) { 3927 whereResult = that.getWhereClause().unwrap().accept(checker_with_sparams); 3928 3928 where = Option.some((WhereClause)whereResult.ast()); 3929 3929 } else { … … 3931 3931 where = Option.<WhereClause>none(); 3932 3932 } 3933 List<TypeCheckerResult> excludesResult = checker_with_sparams.recurOnListOfBaseType(that.getExcludes ());3933 List<TypeCheckerResult> excludesResult = checker_with_sparams.recurOnListOfBaseType(that.getExcludesClause()); 3934 3934 3935 3935 // Verify that this trait only extends other traits … … 3940 3940 }})); 3941 3941 3942 Option<List<TypeCheckerResult>> comprisesResult = checker_with_sparams.recurOnOptionOfListOfBaseType(that.getComprises ());3942 Option<List<TypeCheckerResult>> comprisesResult = checker_with_sparams.recurOnOptionOfListOfBaseType(that.getComprisesClause()); 3943 3943 3944 3944 TypeChecker method_checker = checker_with_sparams; … … 4323 4323 if (lhs.size() == 1) { // We have a single variable binding, not a tuple binding 4324 4324 LValue var = lhs.get(0); 4325 Option<Type> varType = var.get Type();4325 Option<Type> varType = var.getIdType(); 4326 4326 if (varType.isSome()) { 4327 4327 if (initResult.type().isNone()) { -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeEnv.java
r3114 r3122 131 131 protected static Option<Type> typeFromParam(Param param) { 132 132 if (param.getVarargsType().isNone()) { 133 return param.get Type();133 return param.getIdType(); 134 134 } else { // a varargs param 135 135 // Convert the declared varargs type into a reference to … … 148 148 decl.getThrowsClause()), 149 149 decl.getStaticParams(), 150 decl.getWhere ());150 decl.getWhereClause()); 151 151 } 152 152 … … 161 161 for (Param param: params) { 162 162 if (param.getVarargsType().isNone()) { 163 Option<Type> maybeType = param.get Type();163 Option<Type> maybeType = param.getIdType(); 164 164 165 165 if (maybeType.isSome()) { // An explicit type is declared. … … 442 442 public BindingLookup(LValue binding) { 443 443 var = binding.getName(); 444 type = binding.get Type();444 type = binding.getIdType(); 445 445 mods = binding.getMods(); 446 446 mutable = binding.isMutable(); -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/Driver.java
r3096 r3122 295 295 } else if (i instanceof ImportedNames) { 296 296 ImportedNames ix = (ImportedNames) i; 297 APIName source = ix.getApi ();297 APIName source = ix.getApiName(); 298 298 String from_apiname = NodeUtil.nameString(source); 299 299 … … 324 324 /* All names BUT excepts, as they are listed. */ 325 325 final List<IdOrOpOrAnonymousName> excepts = ((ImportStar) ix) 326 .getExcept ();326 .getExceptNames(); 327 327 final Set<String> except_names = Useful.applyToAllInserting( 328 328 excepts, … … 436 436 List<AliasedAPIName> apis = ix.getApis(); 437 437 for (AliasedAPIName adi : apis) { 438 APIName id = adi.getApi ();438 APIName id = adi.getApiName(); 439 439 ensureApiImplemented(fr, linker, pile, id); 440 440 } … … 442 442 else if (i instanceof ImportedNames) { 443 443 ImportedNames ix = (ImportedNames) i; 444 APIName source = ix.getApi ();444 APIName source = ix.getApiName(); 445 445 ensureApiImplemented(fr, linker, pile, source); 446 446 } -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildEnvironments.java
r3112 r3122 674 674 LValue lvb = lhs.get(0); 675 675 676 Option<Type> type = lvb.get Type();676 Option<Type> type = lvb.getIdType(); 677 677 Id name = lvb.getName(); 678 678 String sname = NodeUtil.nameString(name); … … 749 749 750 750 { 751 Option<Type> type = lvb.get Type();751 Option<Type> type = lvb.getIdType(); 752 752 Id name = lvb.getName(); 753 753 String sname = NodeUtil.nameString(name); … … 875 875 876 876 EvalType et; 877 if ( x.getWhere ().isSome() )878 et = processWhereClauses(x.getWhere ().unwrap(), interior);877 if ( x.getWhereClause().isSome() ) 878 et = processWhereClauses(x.getWhereClause().unwrap(), interior); 879 879 else 880 880 et = new EvalType(interior); 881 881 882 882 List<FType> extl = et.getFTypeListFromList(extends_); 883 List<FType> excl = et.getFTypeListFromList(x.getExcludes ());883 List<FType> excl = et.getFTypeListFromList(x.getExcludesClause()); 884 884 ftt.setExtendsAndExcludes(extl, excl, interior); 885 Option<List<BaseType>> comprs = x.getComprises ();885 Option<List<BaseType>> comprs = x.getComprisesClause(); 886 886 if (!comprs.isNone()) { 887 887 List<FType> c = et.getFTypeListFromList(comprs.unwrap()); … … 960 960 public void finishObjectTrait(ObjectDecl x, FTypeObject ftt) { 961 961 List<BaseType> extends_ = NodeUtil.getTypes(x.getExtendsClause()); 962 finishObjectTrait(extends_, null, x.getWhere (), ftt, containing, x);962 finishObjectTrait(extends_, null, x.getWhereClause(), ftt, containing, x); 963 963 } 964 964 -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildLetEnvironments.java
r3082 r3122 128 128 EvalType eval_type = new EvalType(containing); 129 129 for (LValue lvb : lhs) { 130 if (lvb.isMutable() && lvb.get Type().isSome()) {130 if (lvb.isMutable() && lvb.getIdType().isSome()) { 131 131 FValue fv = lvb.accept(new_eval); 132 FType fvt = lvb.get Type().unwrap().accept(eval_type);132 FType fvt = lvb.getIdType().unwrap().accept(eval_type); 133 133 containing.putVariable(fv.getString(),fvt); 134 134 } else { -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildTopLevelEnvironments.java
r3112 r3122 88 88 List<AliasedAPIName> apis = x.getApis(); 89 89 for (AliasedAPIName aliased_api : apis) { 90 APIName imported = aliased_api.getApi ();90 APIName imported = aliased_api.getApiName(); 91 91 importAPIName(imported); 92 92 } … … 96 96 @Override 97 97 public Boolean forImportNames(ImportNames x) { 98 APIName imported = x.getApi ();98 APIName imported = x.getApiName(); 99 99 importAPIName(imported); 100 100 return null; … … 103 103 @Override 104 104 public Boolean forImportStar(ImportStar x) { 105 APIName imported = x.getApi ();105 APIName imported = x.getApiName(); 106 106 importAPIName(imported); 107 107 return null; -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/EvalType.java
r3114 r3122 171 171 FType ptype; 172 172 if (in_p.getVarargsType().isNone()) { 173 Option<Type> type = in_p.get Type();173 Option<Type> type = in_p.getIdType(); 174 174 ptype = e.getFTypeFromOption(type, FTypeTop.ONLY); 175 175 } -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/EvaluatorBase.java
r3107 r3122 208 208 try { 209 209 if (p.getVarargsType().isNone()) { 210 Option<Type> t = p.get Type();210 Option<Type> t = p.getIdType(); 211 211 // why can't we just skip if missing? 212 212 if (t.isNone()) { -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/LHSEvaluator.java
r3111 r3122 144 144 public Voidoid forLValue(LValue x) { 145 145 Id name = x.getName(); 146 Option<Type> type = x.get Type();146 Option<Type> type = x.getIdType(); 147 147 String s = NodeUtil.nameString(name); 148 148 boolean mutable = x.isMutable(); -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/FGenericFunction.java
r3102 r3122 193 193 194 194 protected Option<WhereClause> getWhere() { 195 return fndef.getWhere ();195 return fndef.getWhereClause(); 196 196 } 197 197 -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/SingleFcn.java
r3102 r3122 147 147 static public List<FType> createSymbolicInstantiation(Environment bte, Applicable ap, HasAt location) throws Error { 148 148 List<StaticParam> tpl = ap.getStaticParams(); 149 Option<WhereClause> wcl = ap.getWhere ();149 Option<WhereClause> wcl = ap.getWhereClause(); 150 150 151 151 // The (possibly multiple and interrelated) symbolic -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/glue/NativeApp.java
r3102 r3122 105 105 } 106 106 public IdOrOpOrAnonymousName getName() { return a.getName(); } 107 public Option<WhereClause> getWhere () { return a.getWhere(); }107 public Option<WhereClause> getWhereClause() { return a.getWhereClause(); } 108 108 public String at() { return a.at(); } 109 109 public String stringName() { return a.stringName(); } -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/rewrite/DesugarerVisitor.java
r3112 r3122 792 792 public Node forTraitTypeWhere(TraitTypeWhere vre) { 793 793 lexicalNestingDepth++; 794 Option<WhereClause> owc = vre.getWhere ();794 Option<WhereClause> owc = vre.getWhereClause(); 795 795 if (owc.isSome()) { 796 796 WhereClause wc = owc.unwrap(); … … 880 880 fndef.getStaticParams(), fndef.getParams(), 881 881 fndef.getReturnType(), fndef.getThrowsClause(), 882 fndef.getWhere (), Option.<Contract>none(), Option.<Expr>some(b));882 fndef.getWhereClause(), Option.<Contract>none(), Option.<Expr>some(b)); 883 883 884 884 n = visitNode(f); -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/rewrite/IsAnArrowName.java
r3107 r3122 47 47 @Override 48 48 public ArrowOrFunctional forLValue(LValue that) { 49 return optionTypeIsArrow(that.get Type());49 return optionTypeIsArrow(that.getIdType()); 50 50 } 51 51 … … 76 76 public ArrowOrFunctional forParam(Param that) { 77 77 if ( that.getVarargsType().isNone() ) 78 return optionTypeIsArrow(that.get Type());78 return optionTypeIsArrow(that.getIdType()); 79 79 else 80 80 return ArrowOrFunctional.NEITHER; -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ApiMaker.java
r3119 r3122 127 127 that.getStaticParams(), 128 128 that.getExtendsClause(), 129 that.getWhere (),129 that.getWhereClause(), 130 130 absDecls, 131 that.getExcludes (),132 that.getComprises ()));131 that.getExcludesClause(), 132 that.getComprisesClause())); 133 133 } else return Option.<Node>none(); 134 134 } … … 144 144 that.getStaticParams(), 145 145 that.getExtendsClause(), 146 that.getWhere (),146 that.getWhereClause(), 147 147 absDecls, 148 148 that.getParams(), … … 159 159 List<LValue> lhs = new ArrayList<LValue>(); 160 160 for (LValue lvb : that.getLhs()) { 161 if ( lvb.get Type().isNone() )161 if ( lvb.getIdType().isNone() ) 162 162 log(lvb, "The type of " + lvb.getName() + " is required."); 163 163 if ( inObject && NodeUtil.isVar(lvb.getMods()) ) { … … 181 181 log(that, "The return type of " + that.getName() + " is required."); 182 182 for ( Param p : that.getParams() ) { 183 if ( p.get Type().isNone() &&183 if ( p.getIdType().isNone() && 184 184 p.getVarargsType().isNone() && 185 185 ! p.getName().getText().equals("self") ) … … 200 200 that.getReturnType(), 201 201 that.getThrowsClause(), 202 that.getWhere (),202 that.getWhereClause(), 203 203 that.getContract(), 204 204 Option.<Expr>none(), -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ErrorMsgMaker.java
r3114 r3122 299 299 public String forLValue(LValue node) { 300 300 String r = ""; 301 if (node.get Type().isSome()) {302 r = ":" + node.get Type().unwrap().accept(this);301 if (node.getIdType().isSome()) { 302 r = ":" + node.getIdType().unwrap().accept(this); 303 303 } 304 304 return NodeUtil.nameString(node.getName()) + r; … … 321 321 sb.append(NodeUtil.nameString(node.getName())); 322 322 if ( node.getVarargsType().isNone() ) { 323 if (node.get Type().isSome()) {323 if (node.getIdType().isSome()) { 324 324 sb.append(":"); 325 sb.append(node.get Type().unwrap().accept(this));325 sb.append(node.getIdType().unwrap().accept(this)); 326 326 } 327 327 if (node.getDefaultExpr().isSome()) { -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ExprFactory.java
r3120 r3122 796 796 return new FnExpr(e.getSpan(), true, e.getName(), 797 797 e.getStaticParams(), e.getParams(), 798 e.getReturnType(), e.getWhere (),798 e.getReturnType(), e.getWhereClause(), 799 799 e.getThrowsClause(), e.getBody()); 800 800 } -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeComparator.java
r3114 r3122 212 212 if (x != 0) return x; 213 213 if ((left.getVarargsType().isNone()) && (right.getVarargsType().isNone())) { 214 x = compareOptionalType(left.get Type(), right.getType());214 x = compareOptionalType(left.getIdType(), right.getIdType()); 215 215 } 216 216 if ((left.getVarargsType().isSome()) && (right.getVarargsType().isSome())) { -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeFactory.java
r3120 r3122 772 772 773 773 public static LValue makeLValue(LValue lvb, Id name) { 774 return new LValue(lvb.getSpan(), name, lvb.getMods(), lvb.get Type(),774 return new LValue(lvb.getSpan(), name, lvb.getMods(), lvb.getIdType(), 775 775 lvb.isMutable()); 776 776 } 777 777 778 778 public static LValue makeLValue(LValue lvb, boolean mutable) { 779 return new LValue(lvb.getSpan(), lvb.getName(), lvb.getMods(), lvb.get Type(),779 return new LValue(lvb.getSpan(), lvb.getName(), lvb.getMods(), lvb.getIdType(), 780 780 mutable); 781 781 } … … 787 787 mutable = true; 788 788 } 789 return new LValue(lvb.getSpan(), lvb.getName(), mods, lvb.get Type(), mutable);789 return new LValue(lvb.getSpan(), lvb.getName(), mods, lvb.getIdType(), mutable); 790 790 } 791 791 792 792 public static LValue makeLValue(LValue lvb, List<Modifier> mods, 793 793 boolean mutable) { 794 return new LValue(lvb.getSpan(), lvb.getName(), mods, lvb.get Type(), mutable);794 return new LValue(lvb.getSpan(), lvb.getName(), mods, lvb.getIdType(), mutable); 795 795 } 796 796 … … 819 819 public static LValue makeLValue(Param param) { 820 820 return new LValue(param.getSpan(), param.getName(), 821 param.getMods(), param.get Type(), false);821 param.getMods(), param.getIdType(), false); 822 822 } 823 823 … … 991 991 public static Param makeParam(Param param, Expr expr) { 992 992 return new Param(param.getSpan(), param.getName(), param.getMods(), 993 param.get Type(), Option.some(expr));993 param.getIdType(), Option.some(expr)); 994 994 } 995 995 996 996 public static Param makeParam(Param param, List<Modifier> mods) { 997 997 return new Param(param.getSpan(), param.getName(), mods, 998 param.get Type(), param.getDefaultExpr());998 param.getIdType(), param.getDefaultExpr()); 999 999 } 1000 1000 1001 1001 public static Param makeParam(Param param, Id newId) { 1002 1002 return new Param(param.getSpan(), newId, param.getMods(), 1003 param.get Type(), param.getDefaultExpr());1003 param.getIdType(), param.getDefaultExpr()); 1004 1004 } 1005 1005 -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeUtil.java
r3112 r3122 88 88 if (i instanceof ImportedNames) { 89 89 ImportedNames names = (ImportedNames) i; 90 all.add( names.getApi () );90 all.add( names.getApiName() ); 91 91 } else { // i instanceof ImportApi 92 92 ImportApi apis = (ImportApi) i; 93 93 for (AliasedAPIName a : apis.getApis()) { 94 all.add(a.getApi ());94 all.add(a.getApiName()); 95 95 } 96 96 } … … 104 104 @Override 105 105 public void forImportedNamesDoFirst(ImportedNames that) { 106 Debug.debug(Debug.Type.SYNTAX, 2, "Add import api ", that.getApi ());107 all.add(that.getApi ());106 Debug.debug(Debug.Type.SYNTAX, 2, "Add import api ", that.getApiName()); 107 all.add(that.getApiName()); 108 108 } 109 109 … … 111 111 public void forImportApi(ImportApi that){ 112 112 for (AliasedAPIName api : that.getApis()){ 113 Debug.debug(Debug.Type.SYNTAX, 2, "Add aliased api ", api.getApi ());114 all.add(api.getApi ());113 Debug.debug(Debug.Type.SYNTAX, 2, "Add aliased api ", api.getApiName()); 114 all.add(api.getApiName()); 115 115 } 116 116 } … … 328 328 public static String nameString(IdOrOpOrAnonymousName n) { 329 329 final String last = n.accept(nameGetter); 330 Option<APIName> odn = n.getApi ();330 Option<APIName> odn = n.getApiName(); 331 331 return odn.isSome() ? nameString(odn.unwrap()) + "." + last : last; 332 332 } … … 383 383 @Override 384 384 public String forDimDecl(DimDecl node) { 385 return nameString(node.getDim ());385 return nameString(node.getDimId()); 386 386 } 387 387 @Override … … 445 445 return decl.accept(new NodeAbstractVisitor<IterableOnce<String>>() { 446 446 public IterableOnce<String> forDimDecl(DimDecl d) { 447 return new UnitIterable<String>(d.getDim ().getText());447 return new UnitIterable<String>(d.getDimId().getText()); 448 448 } 449 449 public IterableOnce<String> forUnitDecl(UnitDecl d) { -
trunk/ProjectFortress/src/com/sun/fortress/parser/TraitObject.rats
r3107 r3122 225 225 a1:ParamFldMods? a2:PlainParam 226 226 { if (a1 != null) { 227 if (FortressUtil.getMutable(a1) && a2.get Type().isNone())227 if (FortressUtil.getMutable(a1) && a2.getIdType().isNone()) 228 228 syntaxError(a2.getSpan(), 229 229 "Mutable fields should be declared with their types."); -
trunk/ProjectFortress/src/com/sun/fortress/parser_util/FortressUtil.java
r3115 r3122 397 397 public static void allHaveTypes(List<LValue> vars) { 398 398 for (LValue l : vars) { 399 if (l.get Type().isNone())399 if (l.getIdType().isNone()) 400 400 syntaxError(l.getSpan(), 401 401 "Mutable variables should be declared with their types."); -
trunk/ProjectFortress/src/com/sun/fortress/parser_util/SyntaxChecker.java
r3107 r3122 143 143 if ( that.getInit().isNone() ) { // variable declaration without a body expression 144 144 for (LValue lvb : that.getLhs()) { 145 if ( lvb.get Type().isNone() )145 if ( lvb.getIdType().isNone() ) 146 146 log(lvb, "The type of " + lvb.getName() + " is required."); 147 147 } … … 276 276 if ( (! hasBody) && 277 277 p.getVarargsType().isNone() && 278 p.get Type().isNone() &&278 p.getIdType().isNone() && 279 279 ! p.getName().getText().equals("self") ) 280 280 log(p, "The type of " + p.getName() + " is required."); -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/GrammarComposer.java
r2771 r3122 117 117 Debug.debug(Debug.Type.SYNTAX, 3, 118 118 "Grammar " + grammarDef.getName() + 119 " native?: " + grammarDef.isNative ());120 if (grammarDef.isNative ()) {119 " native?: " + grammarDef.isNativeDef()); 120 if (grammarDef.isNativeDef()) { 121 121 // A native grammar can only contain nonterminal declarations 122 122 for (GrammarMemberDecl member : grammarDef.getMembers()) { … … 187 187 } else if (decl instanceof SuperSyntaxDef) { 188 188 SuperSyntaxDef def = (SuperSyntaxDef) decl; 189 for (SyntaxDecl extension : findExtension(def.getNonterminal(), def.getGrammar ())){189 for (SyntaxDecl extension : findExtension(def.getNonterminal(), def.getGrammarId())){ 190 190 resolveAndAdd(defs, extension, false); 191 191 } -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/environments/EnvFactory.java
r2748 r3122 130 130 GrammarDef og = grammar.ast(); 131 131 List<GrammarIndex> ls = new LinkedList<GrammarIndex>(); 132 for (Id n: og.getExtends ()) {132 for (Id n: og.getExtendsClause()) { 133 133 Debug.debug(Debug.Type.SYNTAX, 3, "Add grammar " + n.getText() + 134 134 "[" + grammarMap.get(n.getText()) + -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/parser/PreParser.java
r3078 r3122 86 86 87 87 @Override public void forImportStarOnly(ImportStar that) { 88 if (env.definesApi(that.getApi ())) {89 APIName api = that.getApi ();88 if (env.definesApi(that.getApiName())) { 89 APIName api = that.getApiName(); 90 90 for (GrammarIndex g: env.api(api).grammars().values()) { 91 if (!that.getExcept ().contains(g.getName())) {91 if (!that.getExceptNames().contains(g.getName())) { 92 92 grammars.add(g); 93 93 } 94 94 } 95 95 } else { 96 StaticError.make("Undefined api: "+that.getApi (), that);96 StaticError.make("Undefined api: "+that.getApiName(), that); 97 97 } 98 98 } 99 99 100 100 @Override public void forImportNamesOnly(ImportNames that) { 101 if (env.definesApi(that.getApi ())) {102 ApiIndex api = env.api(that.getApi ());101 if (env.definesApi(that.getApiName())) { 102 ApiIndex api = env.api(that.getApiName()); 103 103 for (AliasedSimpleName aliasedName: that.getAliasedNames()) { 104 104 if (aliasedName.getName() instanceof Id) { … … 110 110 } 111 111 } else { 112 StaticError.make("Undefined api: "+that.getApi (), that);112 StaticError.make("Undefined api: "+that.getApiName(), that); 113 113 } 114 114 } -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/ComposingSyntaxDefTranslator.java
r3071 r3122 125 125 String parameters = collectParameters(def, code, indents); 126 126 String name = def.getName(); 127 code.add(String.format("yyValue = new _SyntaxTransformation%s(createSpan(yyStart,yyCount), \"%s\", %s, %s);", 127 code.add(String.format("yyValue = new _SyntaxTransformation%s(createSpan(yyStart,yyCount), \"%s\", %s, %s);", 128 128 type, name, BOUND_VARIABLES, parameters)); 129 129 indents.add(3); … … 135 135 } 136 136 137 private static String collectParameters( NamedTransformerDef def, 138 List<String> code, 137 private static String collectParameters( NamedTransformerDef def, 138 List<String> code, 139 139 List<Integer> indents ){ 140 140 String variable = FreshName.getFreshName("parameterList"); 141 code.add(String.format("java.util.List %s = new java.util.LinkedList<String>();", 141 code.add(String.format("java.util.List %s = new java.util.LinkedList<String>();", 142 142 variable)); 143 143 indents.add(3); 144 144 for ( NonterminalParameter parameter : def.getParameters() ){ 145 code.add( String.format( "%s.add( \"%s\" );", 146 variable, 145 code.add( String.format( "%s.add( \"%s\" );", 146 variable, 147 147 parameter.getName().getText() ) ); 148 148 indents.add(3); … … 165 165 } 166 166 167 @Override 167 @Override 168 168 public void forNonterminalSymbol(NonterminalSymbol that) { 169 169 Debug.debug( Debug.Type.SYNTAX, 3, … … 227 227 @Override 228 228 public CharRange forCharacterInterval(CharacterInterval that) { 229 if (that.getBegin ().length() != 1) {230 new MacroError(mess +that.getBegin ());229 if (that.getBeginSymbol().length() != 1) { 230 new MacroError(mess +that.getBeginSymbol()); 231 231 } 232 if (that.getEnd ().length() != 1) {233 new MacroError(mess+that.getEnd ());232 if (that.getEndSymbol().length() != 1) { 233 new MacroError(mess+that.getEndSymbol()); 234 234 } 235 return new CharRange(that.getBegin ().charAt(0), that.getEnd().charAt(0));235 return new CharRange(that.getBeginSymbol().charAt(0), that.getEndSymbol().charAt(0)); 236 236 } 237 237 … … 418 418 String varName = prefixJavaVariable(varId.getText()); 419 419 String baseFortressType = inner.gapEnv.getJavaType(varId); 420 String fullType = varMap.get(varId).getType(baseFortressType); 420 String fullType = varMap.get(varId).getType(baseFortressType); 421 421 indents2.add(1); 422 422 code2.add(modifier.unpackDecl(fullType, varName, packedName, index)); … … 451 451 } 452 452 public String unpackDecl(String fullType, String varName, String packedName, int index) { 453 return String.format("List<%s> %s = com.sun.fortress.syntax_abstractions.util.ArrayUnpacker.<%s>unpack(%s, %d);", 453 return String.format("List<%s> %s = com.sun.fortress.syntax_abstractions.util.ArrayUnpacker.<%s>unpack(%s, %d);", 454 454 fullType, varName, fullType, packedName, index); 455 455 } … … 473 473 */ 474 474 public String unpackDecl(String fullType, String varName, String packedName, int index) { 475 return String.format("%s %s = (%s)(%s == null ? null : %s[%d]);", 476 fullType, varName, fullType, 475 return String.format("%s %s = (%s)(%s == null ? null : %s[%d]);", 476 fullType, varName, fullType, 477 477 packedName, packedName, index); 478 478 } … … 565 565 566 566 indents.add(3); 567 code.add(String.format("%s.put(\"%s\", new Level(NodeFactory.makeSpan(\"blame ComposingSyntaxDefTranslater\"), %d, %s));", 568 BOUND_VARIABLES, 569 var, 570 levelDepth, 567 code.add(String.format("%s.put(\"%s\", new Level(NodeFactory.makeSpan(\"blame ComposingSyntaxDefTranslater\"), %d, %s));", 568 BOUND_VARIABLES, 569 var, 570 levelDepth, 571 571 prefixJavaVariable(resultVar))); 572 572 } … … 583 583 } 584 584 585 private static String convertToStringLiteralExpr(String id, List<String> code, 585 private static String convertToStringLiteralExpr(String id, List<String> code, 586 586 List<Integer> indents) { 587 587 String name = FreshName.getFreshName("stringLiteral"); 588 588 indents.add(3); 589 code.add("StringLiteralExpr " + prefixJavaVariable(name) + 589 code.add("StringLiteralExpr " + prefixJavaVariable(name) + 590 590 " = new StringLiteralExpr(NodeFactory.makeSpan(\"blame ComposingSyntaxDefTranslater\"), \"\"+" + prefixJavaVariable(id) + ");"); 591 591 return name; -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/EscapeRewriter.java
r3071 r3122 87 87 public List<CharacterSymbol> forCharacterInterval(CharacterInterval that) { 88 88 List<CharacterSymbol> head = new LinkedList<CharacterSymbol>(); 89 String begin = removeLeadingEscape(that.getBegin (), head);89 String begin = removeLeadingEscape(that.getBeginSymbol(), head); 90 90 List<CharacterSymbol> tail = new LinkedList<CharacterSymbol>(); 91 String end = removeTrailingEscape(that.getSpan(), that.getEnd (), tail);91 String end = removeTrailingEscape(that.getSpan(), that.getEndSymbol(), tail); 92 92 head.add(new CharacterInterval(that.getSpan(), begin, end)); 93 93 head.addAll(tail); -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/ExtensionDesugarer.java
r2771 r3122 144 144 // Recombine into GrammarDef 145 145 GrammarDef result = 146 new GrammarDef(grammar.getSpan(), grammar.getName(), grammar.getExtends (),147 newMembers, grammar.getTransformers(), grammar.isNative ());146 new GrammarDef(grammar.getSpan(), grammar.getName(), grammar.getExtendsClause(), 147 newMembers, grammar.getTransformers(), grammar.isNativeDef()); 148 148 Debug.debug(Debug.Type.SYNTAX, 3, 149 149 "Desugared grammar into:\n" + result.accept(new FortressAstToConcrete())); … … 233 233 } else if (decl instanceof SuperSyntaxDef) { 234 234 SuperSyntaxDef ssd = (SuperSyntaxDef) decl; 235 Id superGrammarName = ssd.getGrammar ();235 Id superGrammarName = ssd.getGrammarId(); 236 236 if (availableGrammarNames.contains(superGrammarName)) { 237 237 availableGrammarNames.remove(superGrammarName); … … 246 246 throw new MacroError(decl, 247 247 "No extensions of " + name + 248 " in grammar " + ssd.getGrammar ());248 " in grammar " + ssd.getGrammarId()); 249 249 } 250 250 } -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/GrammarRewriter.java
r2771 r3122 162 162 GrammarDef og = e.getValue().ast(); 163 163 List<GrammarIndex> ls = new LinkedList<GrammarIndex>(); 164 for (Id n: og.getExtends ()) {164 for (Id n: og.getExtendsClause()) { 165 165 ls.add(grammars.get(n.getText())); 166 166 } -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/TemplateParser.java
r3071 r3122 62 62 return (Api) raw.accept(new NodeUpdateVisitor() { 63 63 @Override public Node forGrammarDef(GrammarDef that) { 64 if (!that.isNative ()){64 if (!that.isNativeDef()){ 65 65 final Class<?> parser = createParser(findGrammar(that)); 66 66 return that.accept(new NodeUpdateVisitor() { -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/Transform.java
r3115 r3122 271 271 List<Param> params_result = Useful.applyToAll(that.getParams(), renameParam); 272 272 Option<Type> returnType_result = recurOnOptionOfType(that.getReturnType()); 273 Option<WhereClause> where_result = recurOnOptionOfWhereClause(that.getWhere ());273 Option<WhereClause> where_result = recurOnOptionOfWhereClause(that.getWhereClause()); 274 274 Option<List<BaseType>> throwsClause_result = recurOnOptionOfListOfBaseType(that.getThrowsClause()); 275 275 Expr body_result = (Expr) recur(that.getBody()); -
trunk/ProjectFortress/src/com/sun/fortress/tools/FortressAstToConcrete.java
r3120 r3122 413 413 List<String> staticParams_result = recurOnListOfStaticParam(that.getStaticParams()); 414 414 List<String> extendsClause_result = recurOnListOfTraitTypeWhere(that.getExtendsClause()); 415 Option<String> where_result = recurOnOptionOfWhereClause(that.getWhere ());416 List<String> excludes_result = recurOnListOfBaseType(that.getExcludes ());417 Option<List<String>> comprises_result = recurOnOptionOfListOfBaseType(that.getComprises ());415 Option<String> where_result = recurOnOptionOfWhereClause(that.getWhereClause()); 416 List<String> excludes_result = recurOnListOfBaseType(that.getExcludesClause()); 417 Option<List<String>> comprises_result = recurOnOptionOfListOfBaseType(that.getComprisesClause()); 418 418 List<String> decls_result = myRecurOnListOfDecl(that.getDecls()); 419 419 return forTraitDeclOnly(that, mods_result, name_result, … … 477 477 List<String> staticParams_result = recurOnListOfStaticParam(that.getStaticParams()); 478 478 List<String> extendsClause_result = recurOnListOfTraitTypeWhere(that.getExtendsClause()); 479 Option<String> where_result = recurOnOptionOfWhereClause(that.getWhere ());479 Option<String> where_result = recurOnOptionOfWhereClause(that.getWhereClause()); 480 480 Option<List<String>> params_result = recurOnOptionOfListOfParam(that.getParams()); 481 481 Option<List<String>> throwsClause_result = recurOnOptionOfListOfBaseType(that.getThrowsClause()); … … 793 793 StringBuilder s = new StringBuilder(); 794 794 795 if ( that.isNative () ){795 if ( that.isNativeDef() ){ 796 796 s.append( "native " ); 797 797 } … … 1065 1065 1066 1066 @Override public String forCharacterIntervalOnly(CharacterInterval that) { 1067 return that.getBegin () + ":" + that.getEnd();1067 return that.getBeginSymbol() + ":" + that.getEndSymbol(); 1068 1068 } 1069 1069

