summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorcooldome <ariabushenko@bk.ru>2018-06-12 00:28:09 +0100
committercooldome <ariabushenko@bk.ru>2018-06-12 00:28:09 +0100
commita274d77b55ad69d79c1339d5c43f17ce6bec725b (patch)
tree3384bd3db81551596d3720c42f2c935f9479f77e /compiler
parent7302a8ce7a0cc566c098b29fdb73c5da3b8e6ac0 (diff)
downloadNim-a274d77b55ad69d79c1339d5c43f17ce6bec725b.tar.gz
Fixes
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ast.nim9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index dd84452f9..03f02de13 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -1667,8 +1667,7 @@ proc skipStmtList*(n: PNode): PNode =
 proc toRef*(typ: PType): PType =
   ## If ``typ`` is a tyObject then it is converted into a `ref <typ>` and
   ## returned. Otherwise ``typ`` is simply returned as-is.
-  let typ = typ.skipTypes({tyAlias, tyGenericInst})
-  if typ.kind == tyObject:
+  if typ.skipTypes({tyAlias, tyGenericInst}).kind == tyObject:
     result = newType(tyRef, typ.owner)
     rawAddSon(result, typ)
 
@@ -1676,9 +1675,9 @@ proc toObject*(typ: PType): PType =
   ## If ``typ`` is a tyRef then its immediate son is returned (which in many
   ## cases should be a ``tyObject``).
   ## Otherwise ``typ`` is simply returned as-is.
-  result = typ.skipTypes({tyAlias, tyGenericInst})
-  if result.kind == tyRef:
-    result = result.lastSon
+  let t = typ.skipTypes({tyAlias, tyGenericInst})
+  if t.kind == tyRef: t.lastSon
+  else: typ
 
 proc isException*(t: PType): bool =
   # check if `y` is object type and it inherits from Exception
r: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
*
!**/
!*.*

# Cache
nimcache/
rnimcache/
dnimcache/

*.o
!/icons/*.o
*.obj
*.ilk
*.exp
*.pdb
*.lib
*.dll
*.exe
*.so
*.dylib
*.zip
*.iss
*.log
*.pdb

mapping.txt
tags
install.sh
deinstall.sh

doc/html/
doc/*.html
doc/pdf
doc/*.idx
/web/upload
/build/*
bin/*

# iOS specific wildcards.
*.mode1v3
*.pbxuser
*.perspective
*.perspectivev3
*.swp
.DS_Store
.tags
project.xcworkspace/
xcuserdata/

# Generated files.
/compile.json
/compiler/nim.dot
/reject.json
/run.json
/tools/dochack/dochack.js
*.json
/pkgstemp/**/*
# for `nim doc foo.nim`
/*.html
lib/**/*.html
#/testresults.html #covered by /*.html

/testresults.json
testament.db
/tests/**/*.json
/tests/**/*.js
/csources
/dist/
# /lib/fusion # fusion is now unbundled; `git status` should reveal if it's there so users can act on it

# Private directories and files (IDEs)
.*/
~*

# testament cruft; TODO: generate these in a gitignore'd dir (./build) in the first place.
testresults/
test.txt
/test.ini

tweeter.db
tweeter_test.db

/tests/megatest.nim
/tests/ic/*_temp.nim
/tests/navigator/*_temp.nim


/outputExpected.txt
/outputGotten.txt
/t15148.txt
/tests/vm/tfile_rw.txt

/lib/pure/*.js

!/.builds/

!/.github

# ignore debug dirs generated by dsymutil on OSX
*.dSYM

# for `nim c -r nimdoc/tester` etc; this can be in multiple places
htmldocs

## these are not needed anymore unless checkout old older versions
nimdoc.out.css
# except here:
!/nimdoc/testproject/expected/*