diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-07-06 13:15:26 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-06 13:15:26 -0700 |
| commit | af8c0eae90c76d2c8f745badf6f743cefe15f777 (patch) | |
| tree | 57632ee0f4b4944b311c0e50173fbeab0fe7d109 /source/slang/emit.cpp | |
| parent | 21a14cb4e0d578bc4f8a460016269a1199cac0da (diff) | |
| parent | 9795ed654e7b8daaff0bef1ccae1507ff659d3bd (diff) | |
Merge pull request #54 from tfoleyNV/falcor-fixes
Fix issues found during testing of v0.4.0 with Falcor
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 71b39aabb..79a8277bf 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -549,8 +549,8 @@ static void emitSimpleCallExpr( } Emit(context, "("); - int argCount = callExpr->Arguments.Count(); - for (int aa = 0; aa < argCount; ++aa) + UInt argCount = callExpr->Arguments.Count(); + for (UInt aa = 0; aa < argCount; ++aa) { if (aa != 0) Emit(context, ", "); EmitExpr(context, callExpr->Arguments[aa]); @@ -721,8 +721,8 @@ static void emitCallExpr( emit(context, name); Emit(context, "("); - int argCount = callExpr->Arguments.Count(); - for (int aa = 0; aa < argCount; ++aa) + UInt argCount = callExpr->Arguments.Count(); + for (UInt aa = 0; aa < argCount; ++aa) { if (aa != 0) Emit(context, ", "); EmitExpr(context, callExpr->Arguments[aa]); @@ -734,7 +734,7 @@ static void emitCallExpr( { // General case: we are going to emit some more complex text. - int argCount = callExpr->Arguments.Count(); + UInt argCount = callExpr->Arguments.Count(); Emit(context, "("); @@ -782,8 +782,8 @@ static void emitCallExpr( Emit(context, "("); EmitExpr(context, memberExpr->BaseExpression); Emit(context, ")["); - int argCount = callExpr->Arguments.Count(); - for (int aa = 0; aa < argCount; ++aa) + UInt argCount = callExpr->Arguments.Count(); + for (UInt aa = 0; aa < argCount; ++aa) { if (aa != 0) Emit(context, ", "); EmitExpr(context, callExpr->Arguments[aa]); @@ -1483,12 +1483,6 @@ static void EmitType(EmitContext* context, RefPtr<ExpressionType> type, Token co EmitType(context, type, CodePosition(), nameToken.Content, nameToken.Position); } - -static void EmitType(EmitContext* context, RefPtr<ExpressionType> type, String const& name) -{ - EmitType(context, type, CodePosition(), name, CodePosition()); -} - static void EmitType(EmitContext* context, RefPtr<ExpressionType> type) { EmitType(context, type, nullptr); @@ -1497,21 +1491,17 @@ static void EmitType(EmitContext* context, RefPtr<ExpressionType> type) static void EmitType(EmitContext* context, TypeExp const& typeExp, Token const& nameToken) { EmitType(context, typeExp.type, - typeExp.exp ? typeExp.exp->Position : CodePosition(), nameToken.Content, nameToken.Position); + typeExp.exp ? typeExp.exp->Position : CodePosition(), + nameToken.Content, nameToken.Position); } static void EmitType(EmitContext* context, TypeExp const& typeExp, String const& name) { - EmitType(context, typeExp.type, typeExp.exp->Position, name, CodePosition()); -} - -static void EmitType(EmitContext* context, TypeExp const& typeExp) -{ - advanceToSourceLocation(context, typeExp.exp->Position); - EmitType(context, typeExp.type, nullptr); + EmitType(context, typeExp.type, + typeExp.exp ? typeExp.exp->Position : CodePosition(), + name, CodePosition()); } - // Statements // Emit a statement as a `{}`-enclosed block statement, but avoid adding redundant @@ -1974,8 +1964,8 @@ static void EmitDeclRef(EmitContext* context, DeclRef<Decl> declRef) Substitutions* subst = declRef.substitutions.Ptr(); Emit(context, "<"); - int argCount = subst->args.Count(); - for (int aa = 0; aa < argCount; ++aa) + UInt argCount = subst->args.Count(); + for (UInt aa = 0; aa < argCount; ++aa) { if (aa != 0) Emit(context, ","); EmitVal(context, subst->args[aa]); @@ -2064,7 +2054,7 @@ static void EmitModifiers(EmitContext* context, RefPtr<Decl> decl) if (argCount != 0) { Emit(context, "("); - for (int aa = 0; aa < argCount; ++aa) + for (UInt aa = 0; aa < argCount; ++aa) { if (aa != 0) Emit(context, ", "); EmitExpr(context, args[aa]); @@ -3025,9 +3015,9 @@ String emitEntryPoint( // where there were global-scope uniforms. auto globalScopeLayout = programLayout->globalScopeLayout; StructTypeLayout* globalStructLayout = nullptr; - if( auto globalStructLayout = globalScopeLayout.As<StructTypeLayout>() ) + if( auto gs = globalScopeLayout.As<StructTypeLayout>() ) { - globalStructLayout = globalStructLayout.Ptr(); + globalStructLayout = gs.Ptr(); } else if(auto globalConstantBufferLayout = globalScopeLayout.As<ParameterBlockTypeLayout>()) { |
